this.BX=this.BX||{};(function(e){"use strict";
/*! *****************************************************************************
	Copyright (c) Microsoft Corporation.
	Permission to use, copy, modify, and/or distribute this software for any
	purpose with or without fee is hereby granted.
	THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
	REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
	AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
	INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
	LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
	OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
	PERFORMANCE OF THIS SOFTWARE.
	***************************************************************************** */var n=function e(){n=Object.assign||function e(n){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var a in t){if(Object.prototype.hasOwnProperty.call(t,a))n[a]=t[a]}}return n};return n.apply(this,arguments)};function t(e,n,t){if(t||arguments.length===2)for(var r=0,i=n.length,a;r<i;r++){if(a||!(r in n)){if(!a)a=Array.prototype.slice.call(n,0,r);a[r]=n[r]}}return e.concat(a||Array.prototype.slice.call(n))}var r=typeof globalThis!=="undefined"?globalThis:typeof self!=="undefined"?self:typeof window!=="undefined"?window:global;var i=Object.keys;var a=Array.isArray;if(typeof Promise!=="undefined"&&!r.Promise){r.Promise=Promise}function o(e,n){if(babelHelpers["typeof"](n)!=="object")return e;i(n).forEach((function(t){e[t]=n[t]}));return e}var u=Object.getPrototypeOf;var s={}.hasOwnProperty;function c(e,n){return s.call(e,n)}function f(e,n){if(typeof n==="function")n=n(u(e));if(babelHelpers["typeof"](n)!=="object")return;(typeof Reflect==="undefined"?i:Reflect.ownKeys)(n).forEach((function(t){h(e,t,n[t])}))}var l=Object.defineProperty;function h(e,n,t,r){l(e,n,o(t&&c(t,"get")&&typeof t.get==="function"?{get:t.get,set:t.set,configurable:true}:{value:t,configurable:true,writable:true},r))}function d(e){return{from:function n(t){e.prototype=Object.create(t.prototype);h(e.prototype,"constructor",e);return{extend:f.bind(null,e.prototype)}}}}var v=Object.getOwnPropertyDescriptor;function p(e,n){var t=v(e,n);var r;return t||(r=u(e))&&p(r,n)}var y=[].slice;function m(e,n,t){return y.call(e,n,t)}function b(e,n){return n(e)}function g(e){if(!e)throw new Error("Assertion Failed")}function w(e){if(r.setImmediate)setImmediate(e);else setTimeout(e,0)}function _(e,n){return e.reduce((function(e,t,r){var i=n(t,r);if(i)e[i[0]]=i[1];return e}),{})}function x(e,n,t){try{e.apply(null,t)}catch(e){n&&n(e)}}function k(e,n){if(c(e,n))return e[n];if(!n)return e;if(typeof n!=="string"){var t=[];for(var r=0,i=n.length;r<i;++r){var a=k(e,n[r]);t.push(a)}return t}var o=n.indexOf(".");if(o!==-1){var u=e[n.substr(0,o)];return u===undefined?undefined:k(u,n.substr(o+1))}return undefined}function E(e,n,t){if(!e||n===undefined)return;if("isFrozen"in Object&&Object.isFrozen(e))return;if(typeof n!=="string"&&"length"in n){g(typeof t!=="string"&&"length"in t);for(var r=0,i=n.length;r<i;++r){E(e,n[r],t[r])}}else{var o=n.indexOf(".");if(o!==-1){var u=n.substr(0,o);var s=n.substr(o+1);if(s===""){if(t===undefined){if(a(e)&&!isNaN(parseInt(u)))e.splice(u,1);else delete e[u]}else e[u]=t}else{var f=e[u];if(!f||!c(e,u))f=e[u]={};E(f,s,t)}}else{if(t===undefined){if(a(e)&&!isNaN(parseInt(n)))e.splice(n,1);else delete e[n]}else e[n]=t}}}function P(e,n){if(typeof n==="string")E(e,n,undefined);else if("length"in n)[].map.call(n,(function(n){E(e,n,undefined)}))}function K(e){var n={};for(var t in e){if(c(e,t))n[t]=e[t]}return n}var O=[].concat;function S(e){return O.apply([],e)}var A="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(S([8,16,32,64].map((function(e){return["Int","Uint","Float"].map((function(n){return n+e+"Array"}))})))).filter((function(e){return r[e]}));var C=A.map((function(e){return r[e]}));_(A,(function(e){return[e,true]}));var j=null;function I(e){j=typeof WeakMap!=="undefined"&&new WeakMap;var n=D(e);j=null;return n}function D(e){if(!e||babelHelpers["typeof"](e)!=="object")return e;var n=j&&j.get(e);if(n)return n;if(a(e)){n=[];j&&j.set(e,n);for(var t=0,r=e.length;t<r;++t){n.push(D(e[t]))}}else if(C.indexOf(e.constructor)>=0){n=e}else{var i=u(e);n=i===Object.prototype?{}:Object.create(i);j&&j.set(e,n);for(var o in e){if(c(e,o)){n[o]=D(e[o])}}}return n}var B={}.toString;function T(e){return B.call(e).slice(8,-1)}var R=typeof Symbol!=="undefined"?Symbol.iterator:"@@iterator";var F=babelHelpers["typeof"](R)==="symbol"?function(e){var n;return e!=null&&(n=e[R])&&n.apply(e)}:function(){return null};var M={};function N(e){var n,t,r,i;if(arguments.length===1){if(a(e))return e.slice();if(this===M&&typeof e==="string")return[e];if(i=F(e)){t=[];while(r=i.next(),!r.done){t.push(r.value)}return t}if(e==null)return[e];n=e.length;if(typeof n==="number"){t=new Array(n);while(n--){t[n]=e[n]}return t}return[e]}n=arguments.length;t=new Array(n);while(n--){t[n]=arguments[n]}return t}var q=typeof Symbol!=="undefined"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return false};var U=typeof location!=="undefined"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function H(e,n){U=e;L=n}var L=function e(){return true};var V=!new Error("").stack;function W(){if(V)try{throw new Error}catch(e){return e}return new Error}function Y(e,n){var t=e.stack;if(!t)return"";n=n||0;if(t.indexOf(e.name)===0)n+=(e.name+e.message).split("\n").length;return t.split("\n").slice(n).filter(L).map((function(e){return"\n"+e})).join("")}var z=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"];var X=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"];var G=z.concat(X);var Q={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function J(e,n){this._e=W();this.name=e;this.message=n}d(J).from(Error).extend({stack:{get:function e(){return this._stack||(this._stack=this.name+": "+this.message+Y(this._e,2))}},toString:function e(){return this.name+": "+this.message}});function $(e,n){return e+". Errors: "+Object.keys(n).map((function(e){return n[e].toString()})).filter((function(e,n,t){return t.indexOf(e)===n})).join("\n")}function Z(e,n,t,r){this._e=W();this.failures=n;this.failedKeys=r;this.successCount=t;this.message=$(e,n)}d(Z).from(J);function ee(e,n){this._e=W();this.name="BulkError";this.failures=Object.keys(n).map((function(e){return n[e]}));this.failuresByPos=n;this.message=$(e,n)}d(ee).from(J);var ne=G.reduce((function(e,n){return e[n]=n+"Error",e}),{});var te=J;var re=G.reduce((function(e,n){var t=n+"Error";function r(e,r){this._e=W();this.name=t;if(!e){this.message=Q[n]||t;this.inner=null}else if(typeof e==="string"){this.message=""+e+(!r?"":"\n "+r);this.inner=r||null}else if(babelHelpers["typeof"](e)==="object"){this.message=e.name+" "+e.message;this.inner=e}}d(r).from(te);e[n]=r;return e}),{});re.Syntax=SyntaxError;re.Type=TypeError;re.Range=RangeError;var ie=X.reduce((function(e,n){e[n+"Error"]=re[n];return e}),{});function ae(e,n){if(!e||e instanceof J||e instanceof TypeError||e instanceof SyntaxError||!e.name||!ie[e.name])return e;var t=new ie[e.name](n||e.message,e);if("stack"in e){h(t,"stack",{get:function e(){return this.inner.stack}})}return t}var oe=G.reduce((function(e,n){if(["Syntax","Type","Range"].indexOf(n)===-1)e[n+"Error"]=re[n];return e}),{});oe.ModifyError=Z;oe.DexieError=J;oe.BulkError=ee;function ue(){}function se(e){return e}function ce(e,n){if(e==null||e===se)return n;return function(t){return n(e(t))}}function fe(e,n){return function(){e.apply(this,arguments);n.apply(this,arguments)}}function le(e,n){if(e===ue)return n;return function(){var t=e.apply(this,arguments);if(t!==undefined)arguments[0]=t;var r=this.onsuccess,i=this.onerror;this.onsuccess=null;this.onerror=null;var a=n.apply(this,arguments);if(r)this.onsuccess=this.onsuccess?fe(r,this.onsuccess):r;if(i)this.onerror=this.onerror?fe(i,this.onerror):i;return a!==undefined?a:t}}function he(e,n){if(e===ue)return n;return function(){e.apply(this,arguments);var t=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null;n.apply(this,arguments);if(t)this.onsuccess=this.onsuccess?fe(t,this.onsuccess):t;if(r)this.onerror=this.onerror?fe(r,this.onerror):r}}function de(e,n){if(e===ue)return n;return function(t){var r=e.apply(this,arguments);o(t,r);var i=this.onsuccess,a=this.onerror;this.onsuccess=null;this.onerror=null;var u=n.apply(this,arguments);if(i)this.onsuccess=this.onsuccess?fe(i,this.onsuccess):i;if(a)this.onerror=this.onerror?fe(a,this.onerror):a;return r===undefined?u===undefined?undefined:u:o(r,u)}}function ve(e,n){if(e===ue)return n;return function(){if(n.apply(this,arguments)===false)return false;return e.apply(this,arguments)}}function pe(e,n){if(e===ue)return n;return function(){var t=e.apply(this,arguments);if(t&&typeof t.then==="function"){var r=this,i=arguments.length,a=new Array(i);while(i--){a[i]=arguments[i]}return t.then((function(){return n.apply(r,a)}))}return n.apply(this,arguments)}}var ye={};var me=100,be=20,ge=100,we=typeof Promise==="undefined"?[]:function(){var e=Promise.resolve();if(typeof crypto==="undefined"||!crypto.subtle)return[e,u(e),e];var n=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[n,u(n),e]}(),_e=we[0],xe=we[1],ke=we[2],Ee=xe&&xe.then;var Pe=_e&&_e.constructor;var Ke=!!ke;var Oe=false;var Se=ke?function(){ke.then(Je)}:r.setImmediate?setImmediate.bind(null,Je):r.MutationObserver?function(){var e=document.createElement("div");new MutationObserver((function(){Je();e=null})).observe(e,{attributes:true});e.setAttribute("i","1")}:function(){setTimeout(Je,0)};var Ae=function e(n,t){Me.push([n,t]);if(je){Se();je=false}};var Ce=true,je=true,Ie=[],De=[],Be=null,Te=se;var Re={id:"global",global:true,ref:0,unhandleds:[],onunhandled:Kn,pgp:false,env:{},finalize:function e(){this.unhandleds.forEach((function(e){try{Kn(e[0],e[1])}catch(e){}}))}};var Fe=Re;var Me=[];var Ne=0;var qe=[];function Ue(e){if(babelHelpers["typeof"](this)!=="object")throw new TypeError("Promises must be constructed via new");this._listeners=[];this.onuncatched=ue;this._lib=false;var n=this._PSD=Fe;if(U){this._stackHolder=W();this._prev=null;this._numPrev=0}if(typeof e!=="function"){if(e!==ye)throw new TypeError("Not a function");this._state=arguments[1];this._value=arguments[2];if(this._state===false)We(this,this._value);return}this._state=null;this._value=null;++n.ref;Ve(this,e)}var He={get:function e(){var n=Fe,t=ln;function r(e,r){var i=this;var a=!n.global&&(n!==Fe||t!==ln);var o=a&&!pn();var u=new Ue((function(t,u){ze(i,new Le(kn(e,n,a,o),kn(r,n,a,o),t,u,n))}));U&&Qe(u,this);return u}r.prototype=ye;return r},set:function e(n){h(this,"then",n&&n.prototype===ye?He:{get:function e(){return n},set:He.set})}};f(Ue.prototype,{then:He,_then:function e(n,t){ze(this,new Le(null,null,n,t,Fe))},catch:function e(n){if(arguments.length===1)return this.then(null,n);var t=arguments[0],r=arguments[1];return typeof t==="function"?this.then(null,(function(e){return e instanceof t?r(e):an(e)})):this.then(null,(function(e){return e&&e.name===t?r(e):an(e)}))},finally:function e(n){return this.then((function(e){n();return e}),(function(e){n();return an(e)}))},stack:{get:function e(){if(this._stack)return this._stack;try{Oe=true;var n=Ge(this,[],be);var t=n.join("\nFrom previous: ");if(this._state!==null)this._stack=t;return t}finally{Oe=false}}},timeout:function e(n,t){var r=this;return n<Infinity?new Ue((function(e,i){var a=setTimeout((function(){return i(new re.Timeout(t))}),n);r.then(e,i)["finally"](clearTimeout.bind(null,a))})):this}});if(typeof Symbol!=="undefined"&&Symbol.toStringTag)h(Ue.prototype,Symbol.toStringTag,"Dexie.Promise");Re.env=wn();function Le(e,n,t,r,i){this.onFulfilled=typeof e==="function"?e:null;this.onRejected=typeof n==="function"?n:null;this.resolve=t;this.reject=r;this.psd=i}f(Ue,{all:function e(){var n=N.apply(null,arguments).map(yn);return new Ue((function(e,t){if(n.length===0)e([]);var r=n.length;n.forEach((function(i,a){return Ue.resolve(i).then((function(t){n[a]=t;if(!--r)e(n)}),t)}))}))},resolve:function e(n){if(n instanceof Ue)return n;if(n&&typeof n.then==="function")return new Ue((function(e,t){n.then(e,t)}));var t=new Ue(ye,true,n);Qe(t,Be);return t},reject:an,race:function e(){var n=N.apply(null,arguments).map(yn);return new Ue((function(e,t){n.map((function(n){return Ue.resolve(n).then(e,t)}))}))},PSD:{get:function e(){return Fe},set:function e(n){return Fe=n}},totalEchoes:{get:function e(){return ln}},newPSD:dn,usePSD:_n,scheduler:{get:function e(){return Ae},set:function e(n){Ae=n}},rejectionMapper:{get:function e(){return Te},set:function e(n){Te=n}},follow:function e(n,t){return new Ue((function(e,r){return dn((function(e,t){var r=Fe;r.unhandleds=[];r.onunhandled=t;r.finalize=fe((function(){var n=this;nn((function(){n.unhandleds.length===0?e():t(n.unhandleds[0])}))}),r.finalize);n()}),t,e,r)}))}});if(Pe){if(Pe.allSettled)h(Ue,"allSettled",(function(){var e=N.apply(null,arguments).map(yn);return new Ue((function(n){if(e.length===0)n([]);var t=e.length;var r=new Array(t);e.forEach((function(e,i){return Ue.resolve(e).then((function(e){return r[i]={status:"fulfilled",value:e}}),(function(e){return r[i]={status:"rejected",reason:e}})).then((function(){return--t||n(r)}))}))}))}));if(Pe.any&&typeof AggregateError!=="undefined")h(Ue,"any",(function(){var e=N.apply(null,arguments).map(yn);return new Ue((function(n,t){if(e.length===0)t(new AggregateError([]));var r=e.length;var i=new Array(r);e.forEach((function(e,a){return Ue.resolve(e).then((function(e){return n(e)}),(function(e){i[a]=e;if(!--r)t(new AggregateError(i))}))}))}))}))}function Ve(e,n){try{n((function(n){if(e._state!==null)return;if(n===e)throw new TypeError("A promise cannot be resolved with itself.");var t=e._lib&&$e();if(n&&typeof n.then==="function"){Ve(e,(function(e,t){n instanceof Ue?n._then(e,t):n.then(e,t)}))}else{e._state=true;e._value=n;Ye(e)}if(t)Ze()}),We.bind(null,e))}catch(n){We(e,n)}}function We(e,n){De.push(n);if(e._state!==null)return;var t=e._lib&&$e();n=Te(n);e._state=false;e._value=n;U&&n!==null&&babelHelpers["typeof"](n)==="object"&&!n._promise&&x((function(){var t=p(n,"stack");n._promise=e;h(n,"stack",{get:function r(){return Oe?t&&(t.get?t.get.apply(n):t.value):e.stack}})}));tn(e);Ye(e);if(t)Ze()}function Ye(e){var n=e._listeners;e._listeners=[];for(var t=0,r=n.length;t<r;++t){ze(e,n[t])}var i=e._PSD;--i.ref||i.finalize();if(Ne===0){++Ne;Ae((function(){if(--Ne===0)en()}),[])}}function ze(e,n){if(e._state===null){e._listeners.push(n);return}var t=e._state?n.onFulfilled:n.onRejected;if(t===null){return(e._state?n.resolve:n.reject)(e._value)}++n.psd.ref;++Ne;Ae(Xe,[t,e,n])}function Xe(e,n,t){try{Be=n;var r,i=n._value;if(n._state){r=e(i)}else{if(De.length)De=[];r=e(i);if(De.indexOf(i)===-1)rn(n)}t.resolve(r)}catch(e){t.reject(e)}finally{Be=null;if(--Ne===0)en();--t.psd.ref||t.psd.finalize()}}function Ge(e,n,t){if(n.length===t)return n;var r="";if(e._state===false){var i=e._value,a,o;if(i!=null){a=i.name||"Error";o=i.message||i;r=Y(i,0)}else{a=i;o=""}n.push(a+(o?": "+o:"")+r)}if(U){r=Y(e._stackHolder,2);if(r&&n.indexOf(r)===-1)n.push(r);if(e._prev)Ge(e._prev,n,t)}return n}function Qe(e,n){var t=n?n._numPrev+1:0;if(t<me){e._prev=n;e._numPrev=t}}function Je(){$e()&&Ze()}function $e(){var e=Ce;Ce=false;je=false;return e}function Ze(){var e,n,t;do{while(Me.length>0){e=Me;Me=[];t=e.length;for(n=0;n<t;++n){var r=e[n];r[0].apply(null,r[1])}}}while(Me.length>0);Ce=true;je=true}function en(){var e=Ie;Ie=[];e.forEach((function(e){e._PSD.onunhandled.call(null,e._value,e)}));var n=qe.slice(0);var t=n.length;while(t){n[--t]()}}function nn(e){function n(){e();qe.splice(qe.indexOf(n),1)}qe.push(n);++Ne;Ae((function(){if(--Ne===0)en()}),[])}function tn(e){if(!Ie.some((function(n){return n._value===e._value})))Ie.push(e)}function rn(e){var n=Ie.length;while(n){if(Ie[--n]._value===e._value){Ie.splice(n,1);return}}}function an(e){return new Ue(ye,false,e)}function on(e,n){var t=Fe;return function(){var r=$e(),i=Fe;try{gn(t,true);return e.apply(this,arguments)}catch(e){n&&n(e)}finally{gn(i,false);if(r)Ze()}}}var un={awaits:0,echoes:0,id:0};var sn=0;var cn=[];var fn=0;var ln=0;var hn=0;function dn(e,n,t,r){var i=Fe,a=Object.create(i);a.parent=i;a.ref=0;a.global=false;a.id=++hn;var u=Re.env;a.env=Ke?{Promise:Ue,PromiseProp:{value:Ue,configurable:true,writable:true},all:Ue.all,race:Ue.race,allSettled:Ue.allSettled,any:Ue.any,resolve:Ue.resolve,reject:Ue.reject,nthen:En(u.nthen,a),gthen:En(u.gthen,a)}:{};if(n)o(a,n);++i.ref;a.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=_n(a,e,t,r);if(a.ref===0)a.finalize();return s}function vn(){if(!un.id)un.id=++sn;++un.awaits;un.echoes+=ge;return un.id}function pn(){if(!un.awaits)return false;if(--un.awaits===0)un.id=0;un.echoes=un.awaits*ge;return true}if((""+Ee).indexOf("[native code]")===-1){vn=pn=ue}function yn(e){if(un.echoes&&e&&e.constructor===Pe){vn();return e.then((function(e){pn();return e}),(function(e){pn();return On(e)}))}return e}function mn(e){++ln;if(!un.echoes||--un.echoes===0){un.echoes=un.id=0}cn.push(Fe);gn(e,true)}function bn(){var e=cn[cn.length-1];cn.pop();gn(e,false)}function gn(e,n){var t=Fe;if(n?un.echoes&&(!fn++||e!==Fe):fn&&(!--fn||e!==Fe)){xn(n?mn.bind(null,e):bn)}if(e===Fe)return;Fe=e;if(t===Re)Re.env=wn();if(Ke){var i=Re.env.Promise;var a=e.env;xe.then=a.nthen;i.prototype.then=a.gthen;if(t.global||e.global){Object.defineProperty(r,"Promise",a.PromiseProp);i.all=a.all;i.race=a.race;i.resolve=a.resolve;i.reject=a.reject;if(a.allSettled)i.allSettled=a.allSettled;if(a.any)i.any=a.any}}}function wn(){var e=r.Promise||Promise;return Ke?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(r,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:xe.then,gthen:e.prototype.then}:{}}function _n(e,n,t,r,i){var a=Fe;try{gn(e,true);return n(t,r,i)}finally{gn(a,false)}}function xn(e){Ee.call(_e,e)}function kn(e,n,t,r){return typeof e!=="function"?e:function(){var i=Fe;if(t)vn();gn(n,true);try{return e.apply(this,arguments)}finally{gn(i,false);if(r)xn(pn)}}}function En(e,n){return function(t,r){return e.call(this,kn(t,n),kn(r,n))}}var Pn="unhandledrejection";function Kn(e,n){var t;try{t=n.onuncatched(e)}catch(e){}if(t!==false)try{var i,a={promise:n,reason:e};if(r.document&&document.createEvent){i=document.createEvent("Event");i.initEvent(Pn,true,true);o(i,a)}else if(r.CustomEvent){i=new CustomEvent(Pn,{detail:a});o(i,a)}if(i&&r.dispatchEvent){dispatchEvent(i);if(!r.PromiseRejectionEvent&&r.onunhandledrejection)try{r.onunhandledrejection(i)}catch(e){}}if(U&&i&&!i.defaultPrevented){console.warn("Unhandled rejection: "+(e.stack||e))}}catch(e){}}var On=Ue.reject;function Sn(e,n,t,r){if(!e.idbdb||!e._state.openComplete&&!Fe.letThrough&&!e._vip){if(e._state.openComplete){return On(new re.DatabaseClosed(e._state.dbOpenError))}if(!e._state.isBeingOpened){if(!e._options.autoOpen)return On(new re.DatabaseClosed);e.open()["catch"](ue)}return e._state.dbReadyPromise.then((function(){return Sn(e,n,t,r)}))}else{var i=e._createTransaction(n,t,e._dbSchema);try{i.create();e._state.PR1398_maxLoop=3}catch(i){if(i.name===ne.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0){console.warn("Dexie: Need to reopen db");e._close();return e.open().then((function(){return Sn(e,n,t,r)}))}return On(i)}return i._promise(n,(function(e,n){return dn((function(){Fe.trans=i;return r(e,n,i)}))})).then((function(e){return i._completion.then((function(){return e}))}))}}var An="3.2.2";var Cn=String.fromCharCode(65535);var jn=-Infinity;var In="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";var Dn="String expected.";var Bn=[];var Tn=typeof navigator!=="undefined"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent);var Rn=Tn;var Fn=Tn;var Mn=function e(n){return!/(dexie\.js|dexie\.min\.js)/.test(n)};var Nn="__dbnames";var qn="readonly";var Un="readwrite";function Hn(e,n){return e?n?function(){return e.apply(this,arguments)&&n.apply(this,arguments)}:e:n}var Ln={type:3,lower:-Infinity,lowerOpen:false,upper:[[]],upperOpen:false};function Vn(e){return typeof e==="string"&&!/\./.test(e)?function(n){if(n[e]===undefined&&e in n){n=I(n);delete n[e]}return n}:function(e){return e}}var Wn=function(){function e(){}e.prototype._trans=function(e,n,t){var r=this._tx||Fe.trans;var i=this.name;function a(e,t,r){if(!r.schema[i])throw new re.NotFound("Table "+i+" not part of transaction");return n(r.idbtrans,r)}var o=$e();try{return r&&r.db===this.db?r===Fe.trans?r._promise(e,a,t):dn((function(){return r._promise(e,a,t)}),{trans:r,transless:Fe.transless||Fe}):Sn(this.db,e,[this.name],a)}finally{if(o)Ze()}};e.prototype.get=function(e,n){var t=this;if(e&&e.constructor===Object)return this.where(e).first(n);return this._trans("readonly",(function(n){return t.core.get({trans:n,key:e}).then((function(e){return t.hook.reading.fire(e)}))})).then(n)};e.prototype.where=function(e){if(typeof e==="string")return new this.db.WhereClause(this,e);if(a(e))return new this.db.WhereClause(this,"["+e.join("+")+"]");var n=i(e);if(n.length===1)return this.where(n[0]).equals(e[n[0]]);var t=this.schema.indexes.concat(this.schema.primKey).filter((function(e){return e.compound&&n.every((function(n){return e.keyPath.indexOf(n)>=0}))&&e.keyPath.every((function(e){return n.indexOf(e)>=0}))}))[0];if(t&&this.db._maxKey!==Cn)return this.where(t.name).equals(t.keyPath.map((function(n){return e[n]})));if(!t&&U)console.warn("The query "+JSON.stringify(e)+" on "+this.name+" would benefit of a "+("compound index ["+n.join("+")+"]"));var r=this.schema.idxByName;var o=this.db._deps.indexedDB;function u(e,n){try{return o.cmp(e,n)===0}catch(e){return false}}var s=n.reduce((function(n,t){var i=n[0],o=n[1];var s=r[t];var c=e[t];return[i||s,i||!s?Hn(o,s&&s.multi?function(e){var n=k(e,t);return a(n)&&n.some((function(e){return u(c,e)}))}:function(e){return u(c,k(e,t))}):o]}),[null,null]),c=s[0],f=s[1];return c?this.where(c.name).equals(e[c.keyPath]).filter(f):t?this.filter(f):this.where(n).equals("")};e.prototype.filter=function(e){return this.toCollection().and(e)};e.prototype.count=function(e){return this.toCollection().count(e)};e.prototype.offset=function(e){return this.toCollection().offset(e)};e.prototype.limit=function(e){return this.toCollection().limit(e)};e.prototype.each=function(e){return this.toCollection().each(e)};e.prototype.toArray=function(e){return this.toCollection().toArray(e)};e.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))};e.prototype.orderBy=function(e){return new this.db.Collection(new this.db.WhereClause(this,a(e)?"["+e.join("+")+"]":e))};e.prototype.reverse=function(){return this.toCollection().reverse()};e.prototype.mapToClass=function(e){this.schema.mappedClass=e;var n=function n(t){if(!t)return t;var r=Object.create(e.prototype);for(var i in t){if(c(t,i))try{r[i]=t[i]}catch(e){}}return r};if(this.schema.readHook){this.hook.reading.unsubscribe(this.schema.readHook)}this.schema.readHook=n;this.hook("reading",n);return e};e.prototype.defineClass=function(){function e(e){o(this,e)}return this.mapToClass(e)};e.prototype.add=function(e,n){var t=this;var r=this.schema.primKey,i=r.auto,a=r.keyPath;var o=e;if(a&&i){o=Vn(a)(e)}return this._trans("readwrite",(function(e){return t.core.mutate({trans:e,type:"add",keys:n!=null?[n]:null,values:[o]})})).then((function(e){return e.numFailures?Ue.reject(e.failures[0]):e.lastResult})).then((function(n){if(a){try{E(e,a,n)}catch(e){}}return n}))};e.prototype.update=function(e,n){if(babelHelpers["typeof"](e)==="object"&&!a(e)){var t=k(e,this.schema.primKey.keyPath);if(t===undefined)return On(new re.InvalidArgument("Given object does not contain its primary key"));try{if(typeof n!=="function"){i(n).forEach((function(t){E(e,t,n[t])}))}else{n(e,{value:e,primKey:t})}}catch(e){}return this.where(":id").equals(t).modify(n)}else{return this.where(":id").equals(e).modify(n)}};e.prototype.put=function(e,n){var t=this;var r=this.schema.primKey,i=r.auto,a=r.keyPath;var o=e;if(a&&i){o=Vn(a)(e)}return this._trans("readwrite",(function(e){return t.core.mutate({trans:e,type:"put",values:[o],keys:n!=null?[n]:null})})).then((function(e){return e.numFailures?Ue.reject(e.failures[0]):e.lastResult})).then((function(n){if(a){try{E(e,a,n)}catch(e){}}return n}))};e.prototype["delete"]=function(e){var n=this;return this._trans("readwrite",(function(t){return n.core.mutate({trans:t,type:"delete",keys:[e]})})).then((function(e){return e.numFailures?Ue.reject(e.failures[0]):undefined}))};e.prototype.clear=function(){var e=this;return this._trans("readwrite",(function(n){return e.core.mutate({trans:n,type:"deleteRange",range:Ln})})).then((function(e){return e.numFailures?Ue.reject(e.failures[0]):undefined}))};e.prototype.bulkGet=function(e){var n=this;return this._trans("readonly",(function(t){return n.core.getMany({keys:e,trans:t}).then((function(e){return e.map((function(e){return n.hook.reading.fire(e)}))}))}))};e.prototype.bulkAdd=function(e,n,t){var r=this;var i=Array.isArray(n)?n:undefined;t=t||(i?undefined:n);var a=t?t.allKeys:undefined;return this._trans("readwrite",(function(n){var t=r.schema.primKey,o=t.auto,u=t.keyPath;if(u&&i)throw new re.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new re.InvalidArgument("Arguments objects and keys must have the same length");var s=e.length;var c=u&&o?e.map(Vn(u)):e;return r.core.mutate({trans:n,type:"add",keys:i,values:c,wantResults:a}).then((function(e){var n=e.numFailures,t=e.results,i=e.lastResult,o=e.failures;var u=a?t:i;if(n===0)return u;throw new ee(r.name+".bulkAdd(): "+n+" of "+s+" operations failed",o)}))}))};e.prototype.bulkPut=function(e,n,t){var r=this;var i=Array.isArray(n)?n:undefined;t=t||(i?undefined:n);var a=t?t.allKeys:undefined;return this._trans("readwrite",(function(n){var t=r.schema.primKey,o=t.auto,u=t.keyPath;if(u&&i)throw new re.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(i&&i.length!==e.length)throw new re.InvalidArgument("Arguments objects and keys must have the same length");var s=e.length;var c=u&&o?e.map(Vn(u)):e;return r.core.mutate({trans:n,type:"put",keys:i,values:c,wantResults:a}).then((function(e){var n=e.numFailures,t=e.results,i=e.lastResult,o=e.failures;var u=a?t:i;if(n===0)return u;throw new ee(r.name+".bulkPut(): "+n+" of "+s+" operations failed",o)}))}))};e.prototype.bulkDelete=function(e){var n=this;var t=e.length;return this._trans("readwrite",(function(t){return n.core.mutate({trans:t,type:"delete",keys:e})})).then((function(e){var r=e.numFailures,i=e.lastResult,a=e.failures;if(r===0)return i;throw new ee(n.name+".bulkDelete(): "+r+" of "+t+" operations failed",a)}))};return e}();function Yn(e){var n={};var t=function t(r,i){if(i){var a=arguments.length,o=new Array(a-1);while(--a){o[a-1]=arguments[a]}n[r].subscribe.apply(null,o);return e}else if(typeof r==="string"){return n[r]}};t.addEventType=u;for(var r=1,o=arguments.length;r<o;++r){u(arguments[r])}return t;function u(e,r,i){if(babelHelpers["typeof"](e)==="object")return s(e);if(!r)r=ve;if(!i)i=ue;var a={subscribers:[],fire:i,subscribe:function e(n){if(a.subscribers.indexOf(n)===-1){a.subscribers.push(n);a.fire=r(a.fire,n)}},unsubscribe:function e(n){a.subscribers=a.subscribers.filter((function(e){return e!==n}));a.fire=a.subscribers.reduce(r,i)}};n[e]=t[e]=a;return a}function s(e){i(e).forEach((function(n){var t=e[n];if(a(t)){u(n,e[n][0],e[n][1])}else if(t==="asap"){var r=u(n,se,(function e(){var n=arguments.length,t=new Array(n);while(n--){t[n]=arguments[n]}r.subscribers.forEach((function(e){w((function n(){e.apply(null,t)}))}))}))}else throw new re.InvalidArgument("Invalid event config")}))}}function zn(e,n){d(n).from({prototype:e});return n}function Xn(e){return zn(Wn.prototype,(function n(t,r,i){this.db=e;this._tx=i;this.name=t;this.schema=r;this.hook=e._allTables[t]?e._allTables[t].hook:Yn(null,{creating:[le,ue],reading:[ce,se],updating:[de,ue],deleting:[he,ue]})}))}function Gn(e,n){return!(e.filter||e.algorithm||e.or)&&(n?e.justLimit:!e.replayFilter)}function Qn(e,n){e.filter=Hn(e.filter,n)}function Jn(e,n,t){var r=e.replayFilter;e.replayFilter=r?function(){return Hn(r(),n())}:n;e.justLimit=t&&!r}function $n(e,n){e.isMatch=Hn(e.isMatch,n)}function Zn(e,n){if(e.isPrimKey)return n.primaryKey;var t=n.getIndexByKeyPath(e.index);if(!t)throw new re.Schema("KeyPath "+e.index+" on object store "+n.name+" is not indexed");return t}function et(e,n,t){var r=Zn(e,n.schema);return n.openCursor({trans:t,values:!e.keysOnly,reverse:e.dir==="prev",unique:!!e.unique,query:{index:r,range:e.range}})}function nt(e,n,t,r){var i=e.replayFilter?Hn(e.filter,e.replayFilter()):e.filter;if(!e.or){return tt(et(e,r,t),Hn(e.algorithm,i),n,!e.keysOnly&&e.valueMapper)}else{var a={};var o=function e(t,r,o){if(!i||i(r,o,(function(e){return r.stop(e)}),(function(e){return r.fail(e)}))){var u=r.primaryKey;var s=""+u;if(s==="[object ArrayBuffer]")s=""+new Uint8Array(u);if(!c(a,s)){a[s]=true;n(t,r,o)}}};return Promise.all([e.or._iterate(o,t),tt(et(e,r,t),e.algorithm,o,!e.keysOnly&&e.valueMapper)])}}function tt(e,n,t,r){var i=r?function(e,n,i){return t(r(e),n,i)}:t;var a=on(i);return e.then((function(e){if(e){return e.start((function(){var t=function n(){return e["continue"]()};if(!n||n(e,(function(e){return t=e}),(function(n){e.stop(n);t=ue}),(function(n){e.fail(n);t=ue})))a(e.value,e,(function(e){return t=e}));t()}))}}))}function rt(e,n){try{var t=ot(e);var r=ot(n);if(t!==r){if(t==="Array")return 1;if(r==="Array")return-1;if(t==="binary")return 1;if(r==="binary")return-1;if(t==="string")return 1;if(r==="string")return-1;if(t==="Date")return 1;if(r!=="Date")return NaN;return-1}switch(t){case"number":case"Date":case"string":return e>n?1:e<n?-1:0;case"binary":{return at(ut(e),ut(n))}case"Array":return it(e,n)}}catch(e){}return NaN}function it(e,n){var t=e.length;var r=n.length;var i=t<r?t:r;for(var a=0;a<i;++a){var o=rt(e[a],n[a]);if(o!==0)return o}return t===r?0:t<r?-1:1}function at(e,n){var t=e.length;var r=n.length;var i=t<r?t:r;for(var a=0;a<i;++a){if(e[a]!==n[a])return e[a]<n[a]?-1:1}return t===r?0:t<r?-1:1}function ot(e){var n=babelHelpers["typeof"](e);if(n!=="object")return n;if(ArrayBuffer.isView(e))return"binary";var t=T(e);return t==="ArrayBuffer"?"binary":t}function ut(e){if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return new Uint8Array(e)}var st=function(){function e(){}e.prototype._read=function(e,n){var t=this._ctx;return t.error?t.table._trans(null,On.bind(null,t.error)):t.table._trans("readonly",e).then(n)};e.prototype._write=function(e){var n=this._ctx;return n.error?n.table._trans(null,On.bind(null,n.error)):n.table._trans("readwrite",e,"locked")};e.prototype._addAlgorithm=function(e){var n=this._ctx;n.algorithm=Hn(n.algorithm,e)};e.prototype._iterate=function(e,n){return nt(this._ctx,e,n,this._ctx.table.core)};e.prototype.clone=function(e){var n=Object.create(this.constructor.prototype),t=Object.create(this._ctx);if(e)o(t,e);n._ctx=t;return n};e.prototype.raw=function(){this._ctx.valueMapper=null;return this};e.prototype.each=function(e){var n=this._ctx;return this._read((function(t){return nt(n,e,t,n.table.core)}))};e.prototype.count=function(e){var n=this;return this._read((function(e){var t=n._ctx;var r=t.table.core;if(Gn(t,true)){return r.count({trans:e,query:{index:Zn(t,r.schema),range:t.range}}).then((function(e){return Math.min(e,t.limit)}))}else{var i=0;return nt(t,(function(){++i;return false}),e,r).then((function(){return i}))}})).then(e)};e.prototype.sortBy=function(e,n){var t=e.split(".").reverse(),r=t[0],i=t.length-1;function a(e,n){if(n)return a(e[t[n]],n-1);return e[r]}var o=this._ctx.dir==="next"?1:-1;function u(e,n){var t=a(e,i),r=a(n,i);return t<r?-o:t>r?o:0}return this.toArray((function(e){return e.sort(u)})).then(n)};e.prototype.toArray=function(e){var n=this;return this._read((function(e){var t=n._ctx;if(t.dir==="next"&&Gn(t,true)&&t.limit>0){var r=t.valueMapper;var i=Zn(t,t.table.core.schema);return t.table.core.query({trans:e,limit:t.limit,values:true,query:{index:i,range:t.range}}).then((function(e){var n=e.result;return r?n.map(r):n}))}else{var a=[];return nt(t,(function(e){return a.push(e)}),e,t.table.core).then((function(){return a}))}}),e)};e.prototype.offset=function(e){var n=this._ctx;if(e<=0)return this;n.offset+=e;if(Gn(n)){Jn(n,(function(){var n=e;return function(e,t){if(n===0)return true;if(n===1){--n;return false}t((function(){e.advance(n);n=0}));return false}}))}else{Jn(n,(function(){var n=e;return function(){return--n<0}}))}return this};e.prototype.limit=function(e){this._ctx.limit=Math.min(this._ctx.limit,e);Jn(this._ctx,(function(){var n=e;return function(e,t,r){if(--n<=0)t(r);return n>=0}}),true);return this};e.prototype.until=function(e,n){Qn(this._ctx,(function(t,r,i){if(e(t.value)){r(i);return n}else{return true}}));return this};e.prototype.first=function(e){return this.limit(1).toArray((function(e){return e[0]})).then(e)};e.prototype.last=function(e){return this.reverse().first(e)};e.prototype.filter=function(e){Qn(this._ctx,(function(n){return e(n.value)}));$n(this._ctx,e);return this};e.prototype.and=function(e){return this.filter(e)};e.prototype.or=function(e){return new this.db.WhereClause(this._ctx.table,e,this)};e.prototype.reverse=function(){this._ctx.dir=this._ctx.dir==="prev"?"next":"prev";if(this._ondirectionchange)this._ondirectionchange(this._ctx.dir);return this};e.prototype.desc=function(){return this.reverse()};e.prototype.eachKey=function(e){var n=this._ctx;n.keysOnly=!n.isMatch;return this.each((function(n,t){e(t.key,t)}))};e.prototype.eachUniqueKey=function(e){this._ctx.unique="unique";return this.eachKey(e)};e.prototype.eachPrimaryKey=function(e){var n=this._ctx;n.keysOnly=!n.isMatch;return this.each((function(n,t){e(t.primaryKey,t)}))};e.prototype.keys=function(e){var n=this._ctx;n.keysOnly=!n.isMatch;var t=[];return this.each((function(e,n){t.push(n.key)})).then((function(){return t})).then(e)};e.prototype.primaryKeys=function(e){var n=this._ctx;if(n.dir==="next"&&Gn(n,true)&&n.limit>0){return this._read((function(e){var t=Zn(n,n.table.core.schema);return n.table.core.query({trans:e,values:false,limit:n.limit,query:{index:t,range:n.range}})})).then((function(e){var n=e.result;return n})).then(e)}n.keysOnly=!n.isMatch;var t=[];return this.each((function(e,n){t.push(n.primaryKey)})).then((function(){return t})).then(e)};e.prototype.uniqueKeys=function(e){this._ctx.unique="unique";return this.keys(e)};e.prototype.firstKey=function(e){return this.limit(1).keys((function(e){return e[0]})).then(e)};e.prototype.lastKey=function(e){return this.reverse().firstKey(e)};e.prototype.distinct=function(){var e=this._ctx,n=e.index&&e.table.schema.idxByName[e.index];if(!n||!n.multi)return this;var t={};Qn(this._ctx,(function(e){var n=e.primaryKey.toString();var r=c(t,n);t[n]=true;return!r}));return this};e.prototype.modify=function(e){var n=this;var t=this._ctx;return this._write((function(r){var a;if(typeof e==="function"){a=e}else{var o=i(e);var u=o.length;a=function n(t){var r=false;for(var i=0;i<u;++i){var a=o[i],s=e[a];if(k(t,a)!==s){E(t,a,s);r=true}}return r}}var s=t.table.core;var c=s.schema.primaryKey,f=c.outbound,l=c.extractKey;var h=n.db._options.modifyChunkSize||200;var d=[];var v=0;var p=[];var y=function e(n,t){var r=t.failures,a=t.numFailures;v+=n-a;for(var o=0,u=i(r);o<u.length;o++){var s=u[o];d.push(r[s])}};return n.clone().primaryKeys().then((function(n){var i=function i(o){var u=Math.min(h,n.length-o);return s.getMany({trans:r,keys:n.slice(o,o+u),cache:"immutable"}).then((function(c){var d=[];var v=[];var p=f?[]:null;var m=[];for(var b=0;b<u;++b){var g=c[b];var w={value:I(g),primKey:n[o+b]};if(a.call(w,w.value,w)!==false){if(w.value==null){m.push(n[o+b])}else if(!f&&rt(l(g),l(w.value))!==0){m.push(n[o+b]);d.push(w.value)}else{v.push(w.value);if(f)p.push(n[o+b])}}}var _=Gn(t)&&t.limit===Infinity&&(typeof e!=="function"||e===ct)&&{index:t.index,range:t.range};return Promise.resolve(d.length>0&&s.mutate({trans:r,type:"add",values:d}).then((function(e){for(var n in e.failures){m.splice(parseInt(n),1)}y(d.length,e)}))).then((function(){return(v.length>0||_&&babelHelpers["typeof"](e)==="object")&&s.mutate({trans:r,type:"put",keys:p,values:v,criteria:_,changeSpec:typeof e!=="function"&&e}).then((function(e){return y(v.length,e)}))})).then((function(){return(m.length>0||_&&e===ct)&&s.mutate({trans:r,type:"delete",keys:m,criteria:_}).then((function(e){return y(m.length,e)}))})).then((function(){return n.length>o+u&&i(o+h)}))}))};return i(0).then((function(){if(d.length>0)throw new Z("Error modifying one or more objects",d,v,p);return n.length}))}))}))};e.prototype["delete"]=function(){var e=this._ctx,n=e.range;if(Gn(e)&&(e.isPrimKey&&!Fn||n.type===3)){return this._write((function(t){var r=e.table.core.schema.primaryKey;var i=n;return e.table.core.count({trans:t,query:{index:r,range:i}}).then((function(n){return e.table.core.mutate({trans:t,type:"deleteRange",range:i}).then((function(e){var t=e.failures;e.lastResult;e.results;var r=e.numFailures;if(r)throw new Z("Could not delete some values",Object.keys(t).map((function(e){return t[e]})),n-r);return n-r}))}))}))}return this.modify(ct)};return e}();var ct=function e(n,t){return t.value=null};function ft(e){return zn(st.prototype,(function n(t,r){this.db=e;var i=Ln,a=null;if(r)try{i=r()}catch(e){a=e}var o=t._ctx;var u=o.table;var s=u.hook.reading.fire;this._ctx={table:u,index:o.index,isPrimKey:!o.index||u.schema.primKey.keyPath&&o.index===u.schema.primKey.name,range:i,keysOnly:false,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:true,isMatch:null,offset:0,limit:Infinity,error:a,or:o.or,valueMapper:s!==se?s:null}}))}function lt(e,n){return e<n?-1:e===n?0:1}function ht(e,n){return e>n?-1:e===n?0:1}function dt(e,n,t){var r=e instanceof _t?new e.Collection(e):e;r._ctx.error=t?new t(n):new TypeError(n);return r}function vt(e){return new e.Collection(e,(function(){return wt("")})).limit(0)}function pt(e){return e==="next"?function(e){return e.toUpperCase()}:function(e){return e.toLowerCase()}}function yt(e){return e==="next"?function(e){return e.toLowerCase()}:function(e){return e.toUpperCase()}}function mt(e,n,t,r,i,a){var o=Math.min(e.length,r.length);var u=-1;for(var s=0;s<o;++s){var c=n[s];if(c!==r[s]){if(i(e[s],t[s])<0)return e.substr(0,s)+t[s]+t.substr(s+1);if(i(e[s],r[s])<0)return e.substr(0,s)+r[s]+t.substr(s+1);if(u>=0)return e.substr(0,u)+n[u]+t.substr(u+1);return null}if(i(e[s],c)<0)u=s}if(o<r.length&&a==="next")return e+t.substr(e.length);if(o<e.length&&a==="prev")return e.substr(0,t.length);return u<0?null:e.substr(0,u)+r[u]+t.substr(u+1)}function bt(e,n,t,r){var i,a,o,u,s,c,f,l=t.length;if(!t.every((function(e){return typeof e==="string"}))){return dt(e,Dn)}function h(e){i=pt(e);a=yt(e);o=e==="next"?lt:ht;var n=t.map((function(e){return{lower:a(e),upper:i(e)}})).sort((function(e,n){return o(e.lower,n.lower)}));u=n.map((function(e){return e.upper}));s=n.map((function(e){return e.lower}));c=e;f=e==="next"?"":r}h("next");var d=new e.Collection(e,(function(){return gt(u[0],s[l-1]+r)}));d._ondirectionchange=function(e){h(e)};var v=0;d._addAlgorithm((function(e,t,r){var i=e.key;if(typeof i!=="string")return false;var h=a(i);if(n(h,s,v)){return true}else{var d=null;for(var p=v;p<l;++p){var y=mt(i,h,u[p],s[p],o,c);if(y===null&&d===null)v=p+1;else if(d===null||o(d,y)>0){d=y}}if(d!==null){t((function(){e["continue"](d+f)}))}else{t(r)}return false}}));return d}function gt(e,n,t,r){return{type:2,lower:e,upper:n,lowerOpen:t,upperOpen:r}}function wt(e){return{type:1,lower:e,upper:e}}var _t=function(){function e(){}Object.defineProperty(e.prototype,"Collection",{get:function e(){return this._ctx.table.db.Collection},enumerable:false,configurable:true});e.prototype.between=function(e,n,t,r){t=t!==false;r=r===true;try{if(this._cmp(e,n)>0||this._cmp(e,n)===0&&(t||r)&&!(t&&r))return vt(this);return new this.Collection(this,(function(){return gt(e,n,!t,!r)}))}catch(e){return dt(this,In)}};e.prototype.equals=function(e){if(e==null)return dt(this,In);return new this.Collection(this,(function(){return wt(e)}))};e.prototype.above=function(e){if(e==null)return dt(this,In);return new this.Collection(this,(function(){return gt(e,undefined,true)}))};e.prototype.aboveOrEqual=function(e){if(e==null)return dt(this,In);return new this.Collection(this,(function(){return gt(e,undefined,false)}))};e.prototype.below=function(e){if(e==null)return dt(this,In);return new this.Collection(this,(function(){return gt(undefined,e,false,true)}))};e.prototype.belowOrEqual=function(e){if(e==null)return dt(this,In);return new this.Collection(this,(function(){return gt(undefined,e)}))};e.prototype.startsWith=function(e){if(typeof e!=="string")return dt(this,Dn);return this.between(e,e+Cn,true,true)};e.prototype.startsWithIgnoreCase=function(e){if(e==="")return this.startsWith(e);return bt(this,(function(e,n){return e.indexOf(n[0])===0}),[e],Cn)};e.prototype.equalsIgnoreCase=function(e){return bt(this,(function(e,n){return e===n[0]}),[e],"")};e.prototype.anyOfIgnoreCase=function(){var e=N.apply(M,arguments);if(e.length===0)return vt(this);return bt(this,(function(e,n){return n.indexOf(e)!==-1}),e,"")};e.prototype.startsWithAnyOfIgnoreCase=function(){var e=N.apply(M,arguments);if(e.length===0)return vt(this);return bt(this,(function(e,n){return n.some((function(n){return e.indexOf(n)===0}))}),e,Cn)};e.prototype.anyOf=function(){var e=this;var n=N.apply(M,arguments);var t=this._cmp;try{n.sort(t)}catch(e){return dt(this,In)}if(n.length===0)return vt(this);var r=new this.Collection(this,(function(){return gt(n[0],n[n.length-1])}));r._ondirectionchange=function(r){t=r==="next"?e._ascending:e._descending;n.sort(t)};var i=0;r._addAlgorithm((function(e,r,a){var o=e.key;while(t(o,n[i])>0){++i;if(i===n.length){r(a);return false}}if(t(o,n[i])===0){return true}else{r((function(){e["continue"](n[i])}));return false}}));return r};e.prototype.notEqual=function(e){return this.inAnyRange([[jn,e],[e,this.db._maxKey]],{includeLowers:false,includeUppers:false})};e.prototype.noneOf=function(){var e=N.apply(M,arguments);if(e.length===0)return new this.Collection(this);try{e.sort(this._ascending)}catch(e){return dt(this,In)}var n=e.reduce((function(e,n){return e?e.concat([[e[e.length-1][1],n]]):[[jn,n]]}),null);n.push([e[e.length-1],this.db._maxKey]);return this.inAnyRange(n,{includeLowers:false,includeUppers:false})};e.prototype.inAnyRange=function(e,n){var t=this;var r=this._cmp,i=this._ascending,a=this._descending,o=this._min,u=this._max;if(e.length===0)return vt(this);if(!e.every((function(e){return e[0]!==undefined&&e[1]!==undefined&&i(e[0],e[1])<=0}))){return dt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",re.InvalidArgument)}var s=!n||n.includeLowers!==false;var c=n&&n.includeUppers===true;function f(e,n){var t=0,i=e.length;for(;t<i;++t){var a=e[t];if(r(n[0],a[1])<0&&r(n[1],a[0])>0){a[0]=o(a[0],n[0]);a[1]=u(a[1],n[1]);break}}if(t===i)e.push(n);return e}var l=i;function h(e,n){return l(e[0],n[0])}var d;try{d=e.reduce(f,[]);d.sort(h)}catch(e){return dt(this,In)}var v=0;var p=c?function(e){return i(e,d[v][1])>0}:function(e){return i(e,d[v][1])>=0};var y=s?function(e){return a(e,d[v][0])>0}:function(e){return a(e,d[v][0])>=0};function m(e){return!p(e)&&!y(e)}var b=p;var g=new this.Collection(this,(function(){return gt(d[0][0],d[d.length-1][1],!s,!c)}));g._ondirectionchange=function(e){if(e==="next"){b=p;l=i}else{b=y;l=a}d.sort(h)};g._addAlgorithm((function(e,n,r){var a=e.key;while(b(a)){++v;if(v===d.length){n(r);return false}}if(m(a)){return true}else if(t._cmp(a,d[v][1])===0||t._cmp(a,d[v][0])===0){return false}else{n((function(){if(l===i)e["continue"](d[v][0]);else e["continue"](d[v][1])}));return false}}));return g};e.prototype.startsWithAnyOf=function(){var e=N.apply(M,arguments);if(!e.every((function(e){return typeof e==="string"}))){return dt(this,"startsWithAnyOf() only works with strings")}if(e.length===0)return vt(this);return this.inAnyRange(e.map((function(e){return[e,e+Cn]})))};return e}();function xt(e){return zn(_t.prototype,(function n(t,r,i){this.db=e;this._ctx={table:t,index:r===":id"?null:r,or:i};var a=e._deps.indexedDB;if(!a)throw new re.MissingAPI;this._cmp=this._ascending=a.cmp.bind(a);this._descending=function(e,n){return a.cmp(n,e)};this._max=function(e,n){return a.cmp(e,n)>0?e:n};this._min=function(e,n){return a.cmp(e,n)<0?e:n};this._IDBKeyRange=e._deps.IDBKeyRange}))}function kt(e){return on((function(n){Et(n);e(n.target.error);return false}))}function Et(e){if(e.stopPropagation)e.stopPropagation();if(e.preventDefault)e.preventDefault()}var Pt="storagemutated";var Kt="x-storagemutated-1";var Ot=Yn(null,Pt);var St=function(){function e(){}e.prototype._lock=function(){g(!Fe.global);++this._reculock;if(this._reculock===1&&!Fe.global)Fe.lockOwnerFor=this;return this};e.prototype._unlock=function(){g(!Fe.global);if(--this._reculock===0){if(!Fe.global)Fe.lockOwnerFor=null;while(this._blockedFuncs.length>0&&!this._locked()){var e=this._blockedFuncs.shift();try{_n(e[1],e[0])}catch(e){}}}return this};e.prototype._locked=function(){return this._reculock&&Fe.lockOwnerFor!==this};e.prototype.create=function(e){var n=this;if(!this.mode)return this;var t=this.db.idbdb;var r=this.db._state.dbOpenError;g(!this.idbtrans);if(!e&&!t){switch(r&&r.name){case"DatabaseClosedError":throw new re.DatabaseClosed(r);case"MissingAPIError":throw new re.MissingAPI(r.message,r);default:throw new re.OpenFailed(r)}}if(!this.active)throw new re.TransactionInactive;g(this._completion._state===null);e=this.idbtrans=e||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):t.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}));e.onerror=on((function(t){Et(t);n._reject(e.error)}));e.onabort=on((function(t){Et(t);n.active&&n._reject(new re.Abort(e.error));n.active=false;n.on("abort").fire(t)}));e.oncomplete=on((function(){n.active=false;n._resolve();if("mutatedParts"in e){Ot.storagemutated.fire(e["mutatedParts"])}}));return this};e.prototype._promise=function(e,n,t){var r=this;if(e==="readwrite"&&this.mode!=="readwrite")return On(new re.ReadOnly("Transaction is readonly"));if(!this.active)return On(new re.TransactionInactive);if(this._locked()){return new Ue((function(i,a){r._blockedFuncs.push([function(){r._promise(e,n,t).then(i,a)},Fe])}))}else if(t){return dn((function(){var e=new Ue((function(e,t){r._lock();var i=n(e,t,r);if(i&&i.then)i.then(e,t)}));e["finally"]((function(){return r._unlock()}));e._lib=true;return e}))}else{var i=new Ue((function(e,t){var i=n(e,t,r);if(i&&i.then)i.then(e,t)}));i._lib=true;return i}};e.prototype._root=function(){return this.parent?this.parent._root():this};e.prototype.waitFor=function(e){var n=this._root();var t=Ue.resolve(e);if(n._waitingFor){n._waitingFor=n._waitingFor.then((function(){return t}))}else{n._waitingFor=t;n._waitingQueue=[];var r=n.idbtrans.objectStore(n.storeNames[0]);(function e(){++n._spinCount;while(n._waitingQueue.length){n._waitingQueue.shift()()}if(n._waitingFor)r.get(-Infinity).onsuccess=e})()}var i=n._waitingFor;return new Ue((function(e,r){t.then((function(t){return n._waitingQueue.push(on(e.bind(null,t)))}),(function(e){return n._waitingQueue.push(on(r.bind(null,e)))}))["finally"]((function(){if(n._waitingFor===i){n._waitingFor=null}}))}))};e.prototype.abort=function(){if(this.active){this.active=false;if(this.idbtrans)this.idbtrans.abort();this._reject(new re.Abort)}};e.prototype.table=function(e){var n=this._memoizedTables||(this._memoizedTables={});if(c(n,e))return n[e];var t=this.schema[e];if(!t){throw new re.NotFound("Table "+e+" not part of transaction")}var r=new this.db.Table(e,t,this);r.core=this.db.core.table(e);n[e]=r;return r};return e}();function At(e){return zn(St.prototype,(function n(t,r,i,a,o){var u=this;this.db=e;this.mode=t;this.storeNames=r;this.schema=i;this.chromeTransactionDurability=a;this.idbtrans=null;this.on=Yn(this,"complete","error","abort");this.parent=o||null;this.active=true;this._reculock=0;this._blockedFuncs=[];this._resolve=null;this._reject=null;this._waitingFor=null;this._waitingQueue=null;this._spinCount=0;this._completion=new Ue((function(e,n){u._resolve=e;u._reject=n}));this._completion.then((function(){u.active=false;u.on.complete.fire()}),(function(e){var n=u.active;u.active=false;u.on.error.fire(e);u.parent?u.parent._reject(e):n&&u.idbtrans&&u.idbtrans.abort();return On(e)}))}))}function Ct(e,n,t,r,i,a,o){return{name:e,keyPath:n,unique:t,multi:r,auto:i,compound:a,src:(t&&!o?"&":"")+(r?"*":"")+(i?"++":"")+jt(n)}}function jt(e){return typeof e==="string"?e:e?"["+[].join.call(e,"+")+"]":""}function It(e,n,t){return{name:e,primKey:n,indexes:t,mappedClass:null,idxByName:_(t,(function(e){return[e.name,e]}))}}function Dt(e){return e.length===1?e[0]:e}var Bt=function e(n){try{n.only([[]]);Bt=function e(){return[[]]};return[[]]}catch(e){Bt=function e(){return Cn};return Cn}};function Tt(e){if(e==null){return function(){return undefined}}else if(typeof e==="string"){return Rt(e)}else{return function(n){return k(n,e)}}}function Rt(e){var n=e.split(".");if(n.length===1){return function(n){return n[e]}}else{return function(n){return k(n,e)}}}function Ft(e){return[].slice.call(e)}var Mt=0;function Nt(e){return e==null?":id":typeof e==="string"?e:"["+e.join("+")+"]"}function qt(e,n,t){function r(e,n){var t=Ft(e.objectStoreNames);return{schema:{name:e.name,tables:t.map((function(e){return n.objectStore(e)})).map((function(e){var n=e.keyPath,t=e.autoIncrement;var r=a(n);var i=n==null;var o={};var u={name:e.name,primaryKey:{name:null,isPrimaryKey:true,outbound:i,compound:r,keyPath:n,autoIncrement:t,unique:true,extractKey:Tt(n)},indexes:Ft(e.indexNames).map((function(n){return e.index(n)})).map((function(e){var n=e.name,t=e.unique,r=e.multiEntry,i=e.keyPath;var u=a(i);var s={name:n,compound:u,keyPath:i,unique:t,multiEntry:r,extractKey:Tt(i)};o[Nt(i)]=s;return s})),getIndexByKeyPath:function e(n){return o[Nt(n)]}};o[":id"]=u.primaryKey;if(n!=null){o[Nt(n)]=u.primaryKey}return u}))},hasGetAll:t.length>0&&"getAll"in n.objectStore(t[0])&&!(typeof navigator!=="undefined"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function i(e){if(e.type===3)return null;if(e.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var t=e.lower,r=e.upper,i=e.lowerOpen,a=e.upperOpen;var o=t===undefined?r===undefined?null:n.upperBound(r,!!a):r===undefined?n.lowerBound(t,!!i):n.bound(t,r,!!i,!!a);return o}function o(e){var n=e.name;function t(e){var t=e.trans,r=e.type,a=e.keys,o=e.values,u=e.range;return new Promise((function(e,s){e=on(e);var c=t.objectStore(n);var f=c.keyPath==null;var l=r==="put"||r==="add";if(!l&&r!=="delete"&&r!=="deleteRange")throw new Error("Invalid operation type: "+r);var h=(a||o||{length:1}).length;if(a&&o&&a.length!==o.length){throw new Error("Given keys array must have same length as given values array.")}if(h===0)return e({numFailures:0,failures:{},results:[],lastResult:undefined});var d;var v=[];var p=[];var y=0;var m=function e(n){++y;Et(n)};if(r==="deleteRange"){if(u.type===4)return e({numFailures:y,failures:p,results:[],lastResult:undefined});if(u.type===3)v.push(d=c.clear());else v.push(d=c["delete"](i(u)))}else{var b=l?f?[o,a]:[o,null]:[a,null],g=b[0],w=b[1];if(l){for(var _=0;_<h;++_){v.push(d=w&&w[_]!==undefined?c[r](g[_],w[_]):c[r](g[_]));d.onerror=m}}else{for(var _=0;_<h;++_){v.push(d=c[r](g[_]));d.onerror=m}}}var x=function n(t){var i=t.target.result;v.forEach((function(e,n){return e.error!=null&&(p[n]=e.error)}));e({numFailures:y,failures:p,results:r==="delete"?a:v.map((function(e){return e.result})),lastResult:i})};d.onerror=function(e){m(e);x(e)};d.onsuccess=x}))}function r(e){var t=e.trans,r=e.values,a=e.query,o=e.reverse,u=e.unique;return new Promise((function(e,s){e=on(e);var c=a.index,f=a.range;var l=t.objectStore(n);var h=c.isPrimaryKey?l:l.index(c.name);var d=o?u?"prevunique":"prev":u?"nextunique":"next";var v=r||!("openKeyCursor"in h)?h.openCursor(i(f),d):h.openKeyCursor(i(f),d);v.onerror=kt(s);v.onsuccess=on((function(n){var r=v.result;if(!r){e(null);return}r.___id=++Mt;r.done=false;var i=r["continue"].bind(r);var a=r.continuePrimaryKey;if(a)a=a.bind(r);var o=r.advance.bind(r);var u=function e(){throw new Error("Cursor not started")};var c=function e(){throw new Error("Cursor not stopped")};r.trans=t;r.stop=r["continue"]=r.continuePrimaryKey=r.advance=u;r.fail=on(s);r.next=function(){var e=this;var n=1;return this.start((function(){return n--?e["continue"]():e.stop()})).then((function(){return e}))};r.start=function(e){var n=new Promise((function(e,n){e=on(e);v.onerror=kt(n);r.fail=n;r.stop=function(n){r.stop=r["continue"]=r.continuePrimaryKey=r.advance=c;e(n)}}));var t=function n(){if(v.result){try{e()}catch(e){r.fail(e)}}else{r.done=true;r.start=function(){throw new Error("Cursor behind last entry")};r.stop()}};v.onsuccess=on((function(e){v.onsuccess=t;t()}));r["continue"]=i;r.continuePrimaryKey=a;r.advance=o;t();return n};e(r)}),s)}))}function a(e){return function(t){return new Promise((function(r,a){r=on(r);var o=t.trans,u=t.values,s=t.limit,c=t.query;var f=s===Infinity?undefined:s;var l=c.index,h=c.range;var d=o.objectStore(n);var v=l.isPrimaryKey?d:d.index(l.name);var p=i(h);if(s===0)return r({result:[]});if(e){var y=u?v.getAll(p,f):v.getAllKeys(p,f);y.onsuccess=function(e){return r({result:e.target.result})};y.onerror=kt(a)}else{var m=0;var b=u||!("openKeyCursor"in v)?v.openCursor(p):v.openKeyCursor(p);var g=[];b.onsuccess=function(e){var n=b.result;if(!n)return r({result:g});g.push(u?n.value:n.primaryKey);if(++m===s)return r({result:g});n["continue"]()};b.onerror=kt(a)}}))}}return{name:n,schema:e,mutate:t,getMany:function e(t){var r=t.trans,i=t.keys;return new Promise((function(e,t){e=on(e);var a=r.objectStore(n);var o=i.length;var u=new Array(o);var s=0;var c=0;var f;var l=function n(t){var r=t.target;if((u[r._pos]=r.result)!=null);if(++c===s)e(u)};var h=kt(t);for(var d=0;d<o;++d){var v=i[d];if(v!=null){f=a.get(i[d]);f._pos=d;f.onsuccess=l;f.onerror=h;++s}}if(s===0)e(u)}))},get:function e(t){var r=t.trans,i=t.key;return new Promise((function(e,t){e=on(e);var a=r.objectStore(n);var o=a.get(i);o.onsuccess=function(n){return e(n.target.result)};o.onerror=kt(t)}))},query:a(c),openCursor:r,count:function e(t){var r=t.query,a=t.trans;var o=r.index,u=r.range;return new Promise((function(e,t){var r=a.objectStore(n);var s=o.isPrimaryKey?r:r.index(o.name);var c=i(u);var f=c?s.count(c):s.count();f.onsuccess=on((function(n){return e(n.target.result)}));f.onerror=kt(t)}))}}}var u=r(e,t),s=u.schema,c=u.hasGetAll;var f=s.tables.map((function(e){return o(e)}));var l={};f.forEach((function(e){return l[e.name]=e}));return{stack:"dbcore",transaction:e.transaction.bind(e),table:function e(n){var t=l[n];if(!t)throw new Error("Table '"+n+"' not found");return l[n]},MIN_KEY:-Infinity,MAX_KEY:Bt(n),schema:s}}function Ut(e,t){return t.reduce((function(e,t){var r=t.create;return n(n({},e),r(e))}),e)}function Ht(e,n,t,r){var i=t.IDBKeyRange;t.indexedDB;var a=Ut(qt(n,i,r),e.dbcore);return{dbcore:a}}function Lt(e,n){var t=e._novip;var r=n.db;var i=Ht(t._middlewares,r,t._deps,n);t.core=i.dbcore;t.tables.forEach((function(e){var n=e.name;if(t.core.schema.tables.some((function(e){return e.name===n}))){e.core=t.core.table(n);if(t[n]instanceof t.Table){t[n].core=e.core}}}))}function Vt(e,n,t,r){var i=e._novip;t.forEach((function(e){var t=r[e];n.forEach((function(n){var r=p(n,e);if(!r||"value"in r&&r.value===undefined){if(n===i.Transaction.prototype||n instanceof i.Transaction){h(n,e,{get:function n(){return this.table(e)},set:function n(t){l(this,e,{value:t,writable:true,configurable:true,enumerable:true})}})}else{n[e]=new i.Table(e,t)}}}))}))}function Wt(e,n){var t=e._novip;n.forEach((function(e){for(var n in e){if(e[n]instanceof t.Table)delete e[n]}}))}function Yt(e,n){return e._cfg.version-n._cfg.version}function zt(e,n,t,r){var a=e._dbSchema;var o=e._createTransaction("readwrite",e._storeNames,a);o.create(t);o._completion["catch"](r);var u=o._reject.bind(o);var s=Fe.transless||Fe;dn((function(){Fe.trans=o;Fe.transless=s;if(n===0){i(a).forEach((function(e){Qt(t,e,a[e].primKey,a[e].indexes)}));Lt(e,t);Ue.follow((function(){return e.on.populate.fire(o)}))["catch"](u)}else Xt(e,n,o,t)["catch"](u)}))}function Xt(e,n,t,r){var a=e._novip;var o=[];var u=a._versions;var s=a._dbSchema=er(a,a.idbdb,r);var c=false;var f=u.filter((function(e){return e._cfg.version>=n}));f.forEach((function(e){o.push((function(){var o=s;var u=e._cfg.dbschema;rr(a,o,r);rr(a,u,r);s=a._dbSchema=u;var f=Gt(o,u);f.add.forEach((function(e){Qt(r,e[0],e[1].primKey,e[1].indexes)}));f.change.forEach((function(e){if(e.recreate){throw new re.Upgrade("Not yet support for changing primary key")}else{var n=r.objectStore(e.name);e.add.forEach((function(e){return Zt(n,e)}));e.change.forEach((function(e){n.deleteIndex(e.name);Zt(n,e)}));e.del.forEach((function(e){return n.deleteIndex(e)}))}}));var l=e._cfg.contentUpgrade;if(l&&e._cfg.version>n){Lt(a,r);t._memoizedTables={};c=true;var h=K(u);f.del.forEach((function(e){h[e]=o[e]}));Wt(a,[a.Transaction.prototype]);Vt(a,[a.Transaction.prototype],i(h),h);t.schema=h;var d=q(l);if(d){vn()}var v;var p=Ue.follow((function(){v=l(t);if(v){if(d){var e=pn.bind(null,null);v.then(e,e)}}}));return v&&typeof v.then==="function"?Ue.resolve(v):p.then((function(){return v}))}}));o.push((function(n){if(!c||!Rn){var r=e._cfg.dbschema;$t(r,n)}Wt(a,[a.Transaction.prototype]);Vt(a,[a.Transaction.prototype],a._storeNames,a._dbSchema);t.schema=a._dbSchema}))}));function l(){return o.length?Ue.resolve(o.shift()(t.idbtrans)).then(l):Ue.resolve()}return l().then((function(){Jt(s,r)}))}function Gt(e,n){var t={del:[],add:[],change:[]};var r;for(r in e){if(!n[r])t.del.push(r)}for(r in n){var i=e[r],a=n[r];if(!i){t.add.push([r,a])}else{var o={name:r,def:a,recreate:false,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!==""+(a.primKey.keyPath||"")||i.primKey.auto!==a.primKey.auto&&!Tn){o.recreate=true;t.change.push(o)}else{var u=i.idxByName;var s=a.idxByName;var c=void 0;for(c in u){if(!s[c])o.del.push(c)}for(c in s){var f=u[c],l=s[c];if(!f)o.add.push(l);else if(f.src!==l.src)o.change.push(l)}if(o.del.length>0||o.add.length>0||o.change.length>0){t.change.push(o)}}}}return t}function Qt(e,n,t,r){var i=e.db.createObjectStore(n,t.keyPath?{keyPath:t.keyPath,autoIncrement:t.auto}:{autoIncrement:t.auto});r.forEach((function(e){return Zt(i,e)}));return i}function Jt(e,n){i(e).forEach((function(t){if(!n.db.objectStoreNames.contains(t)){Qt(n,t,e[t].primKey,e[t].indexes)}}))}function $t(e,n){[].slice.call(n.db.objectStoreNames).forEach((function(t){return e[t]==null&&n.db.deleteObjectStore(t)}))}function Zt(e,n){e.createIndex(n.name,n.keyPath,{unique:n.unique,multiEntry:n.multi})}function er(e,n,t){var r={};var i=m(n.objectStoreNames,0);i.forEach((function(e){var n=t.objectStore(e);var i=n.keyPath;var a=Ct(jt(i),i||"",false,false,!!n.autoIncrement,i&&typeof i!=="string",true);var o=[];for(var u=0;u<n.indexNames.length;++u){var s=n.index(n.indexNames[u]);i=s.keyPath;var c=Ct(s.name,i,!!s.unique,!!s.multiEntry,false,i&&typeof i!=="string",false);o.push(c)}r[e]=It(e,a,o)}));return r}function nr(e,n,t){var r=e._novip;r.verno=n.version/10;var a=r._dbSchema=er(r,n,t);r._storeNames=m(n.objectStoreNames,0);Vt(r,[r._allTables],i(a),a)}function tr(e,n){var t=er(e,e.idbdb,n);var r=Gt(t,e._dbSchema);return!(r.add.length||r.change.some((function(e){return e.add.length||e.change.length})))}function rr(e,n,t){var i=e._novip;var a=t.db.objectStoreNames;for(var o=0;o<a.length;++o){var u=a[o];var s=t.objectStore(u);i._hasGetAll="getAll"in s;for(var c=0;c<s.indexNames.length;++c){var f=s.indexNames[c];var l=s.index(f).keyPath;var h=typeof l==="string"?l:"["+m(l).join("+")+"]";if(n[u]){var d=n[u].idxByName[h];if(d){d.name=f;delete n[u].idxByName[h];n[u].idxByName[f]=d}}}}if(typeof navigator!=="undefined"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&r.WorkerGlobalScope&&r instanceof r.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604){i._hasGetAll=false}}function ir(e){return e.split(",").map((function(e,n){e=e.trim();var t=e.replace(/([&*]|\+\+)/g,"");var r=/^\[/.test(t)?t.match(/^\[(.*)\]$/)[1].split("+"):t;return Ct(t,r||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),a(r),n===0)}))}var ar=function(){function e(){}e.prototype._parseStoresSpec=function(e,n){i(e).forEach((function(t){if(e[t]!==null){var r=ir(e[t]);var i=r.shift();if(i.multi)throw new re.Schema("Primary key cannot be multi-valued");r.forEach((function(e){if(e.auto)throw new re.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new re.Schema("Index must have a name and cannot be an empty string")}));n[t]=It(t,i,r)}}))};e.prototype.stores=function(e){var n=this.db;this._cfg.storesSource=this._cfg.storesSource?o(this._cfg.storesSource,e):e;var t=n._versions;var r={};var a={};t.forEach((function(e){o(r,e._cfg.storesSource);a=e._cfg.dbschema={};e._parseStoresSpec(r,a)}));n._dbSchema=a;Wt(n,[n._allTables,n,n.Transaction.prototype]);Vt(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],i(a),a);n._storeNames=i(a);return this};e.prototype.upgrade=function(e){this._cfg.contentUpgrade=pe(this._cfg.contentUpgrade||ue,e);return this};return e}();function or(e){return zn(ar.prototype,(function n(t){this.db=e;this._cfg={version:t,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}}))}function ur(e,n){var t=e["_dbNamesDB"];if(!t){t=e["_dbNamesDB"]=new Mr(Nn,{addons:[],indexedDB:e,IDBKeyRange:n});t.version(1).stores({dbnames:"name"})}return t.table("dbnames")}function sr(e){return e&&typeof e.databases==="function"}function cr(e){var n=e.indexedDB,t=e.IDBKeyRange;return sr(n)?Promise.resolve(n.databases()).then((function(e){return e.map((function(e){return e.name})).filter((function(e){return e!==Nn}))})):ur(n,t).toCollection().primaryKeys()}function fr(e,n){var t=e.indexedDB,r=e.IDBKeyRange;!sr(t)&&n!==Nn&&ur(t,r).put({name:n})["catch"](ue)}function lr(e,n){var t=e.indexedDB,r=e.IDBKeyRange;!sr(t)&&n!==Nn&&ur(t,r)["delete"](n)["catch"](ue)}function hr(e){return dn((function(){Fe.letThrough=true;return e()}))}function dr(){var e=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!e||!indexedDB.databases)return Promise.resolve();var n;return new Promise((function(e){var t=function n(){return indexedDB.databases()["finally"](e)};n=setInterval(t,100);t()}))["finally"]((function(){return clearInterval(n)}))}function vr(e){var n=e._state;var t=e._deps.indexedDB;if(n.isBeingOpened||e.idbdb)return n.dbReadyPromise.then((function(){return n.dbOpenError?On(n.dbOpenError):e}));U&&(n.openCanceller._stackHolder=W());n.isBeingOpened=true;n.dbOpenError=null;n.openComplete=false;var r=n.openCanceller;function i(){if(n.openCanceller!==r)throw new re.DatabaseClosed("db.open() was cancelled")}var a=n.dbReadyResolve,o=null,u=false;return Ue.race([r,(typeof navigator==="undefined"?Ue.resolve():dr()).then((function(){return new Ue((function(r,a){i();if(!t)throw new re.MissingAPI;var s=e.name;var c=n.autoSchema?t.open(s):t.open(s,Math.round(e.verno*10));if(!c)throw new re.MissingAPI;c.onerror=kt(a);c.onblocked=on(e._fireOnBlocked);c.onupgradeneeded=on((function(r){o=c.transaction;if(n.autoSchema&&!e._options.allowEmptyDB){c.onerror=Et;o.abort();c.result.close();var i=t.deleteDatabase(s);i.onsuccess=i.onerror=on((function(){a(new re.NoSuchDatabase("Database "+s+" doesnt exist"))}))}else{o.onerror=kt(a);var f=r.oldVersion>Math.pow(2,62)?0:r.oldVersion;u=f<1;e._novip.idbdb=c.result;zt(e,f/10,o,a)}}),a);c.onsuccess=on((function(){o=null;var t=e._novip.idbdb=c.result;var i=m(t.objectStoreNames);if(i.length>0)try{var a=t.transaction(Dt(i),"readonly");if(n.autoSchema)nr(e,t,a);else{rr(e,e._dbSchema,a);if(!tr(e,a)){console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")}}Lt(e,a)}catch(e){}Bn.push(e);t.onversionchange=on((function(t){n.vcFired=true;e.on("versionchange").fire(t)}));t.onclose=on((function(n){e.on("close").fire(n)}));if(u)fr(e._deps,s);r()}),a)}))}))]).then((function(){i();n.onReadyBeingFired=[];return Ue.resolve(hr((function(){return e.on.ready.fire(e.vip)}))).then((function t(){if(n.onReadyBeingFired.length>0){var r=n.onReadyBeingFired.reduce(pe,ue);n.onReadyBeingFired=[];return Ue.resolve(hr((function(){return r(e.vip)}))).then(t)}}))}))["finally"]((function(){n.onReadyBeingFired=null;n.isBeingOpened=false})).then((function(){return e}))["catch"]((function(t){n.dbOpenError=t;try{o&&o.abort()}catch(e){}if(r===n.openCanceller){e._close()}return On(t)}))["finally"]((function(){n.openComplete=true;a()}))}function pr(e){var n=function n(t){return e.next(t)},t=function n(t){return e["throw"](t)},r=o(n),i=o(t);function o(e){return function(n){var t=e(n),o=t.value;return t.done?o:!o||typeof o.then!=="function"?a(o)?Promise.all(o).then(r,i):r(o):o.then(r,i)}}return o(n)()}function yr(e,n,t){var r=arguments.length;if(r<2)throw new re.InvalidArgument("Too few arguments");var i=new Array(r-1);while(--r){i[r-1]=arguments[r]}t=i.pop();var a=S(i);return[e,a,t]}function mr(e,n,t,r,i){return Ue.resolve().then((function(){var a=Fe.transless||Fe;var o=e._createTransaction(n,t,e._dbSchema,r);var u={trans:o,transless:a};if(r){o.idbtrans=r.idbtrans}else{try{o.create();e._state.PR1398_maxLoop=3}catch(r){if(r.name===ne.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0){console.warn("Dexie: Need to reopen db");e._close();return e.open().then((function(){return mr(e,n,t,null,i)}))}return On(r)}}var s=q(i);if(s){vn()}var c;var f=Ue.follow((function(){c=i.call(o,o);if(c){if(s){var e=pn.bind(null,null);c.then(e,e)}else if(typeof c.next==="function"&&typeof c["throw"]==="function"){c=pr(c)}}}),u);return(c&&typeof c.then==="function"?Ue.resolve(c).then((function(e){return o.active?e:On(new re.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))})):f.then((function(){return c}))).then((function(e){if(r)o._resolve();return o._completion.then((function(){return e}))}))["catch"]((function(e){o._reject(e);return On(e)}))}))}function br(e,n,t){var r=a(e)?e.slice():[e];for(var i=0;i<t;++i){r.push(n)}return r}function gr(e){return n(n({},e),{table:function t(r){var t=e.table(r);var i=t.schema;var a={};var o=[];function u(e,t,r){var i=Nt(e);var s=a[i]=a[i]||[];var c=e==null?0:typeof e==="string"?1:e.length;var f=t>0;var l=n(n({},r),{isVirtual:f,keyTail:t,keyLength:c,extractKey:Tt(e),unique:!f&&r.unique});s.push(l);if(!l.isPrimaryKey){o.push(l)}if(c>1){var h=c===2?e[0]:e.slice(0,c-1);u(h,t+1,r)}s.sort((function(e,n){return e.keyTail-n.keyTail}));return l}var s=u(i.primaryKey.keyPath,0,i.primaryKey);a[":id"]=[s];for(var c=0,f=i.indexes;c<f.length;c++){var l=f[c];u(l.keyPath,0,l)}function h(e){var n=a[Nt(e)];return n&&n[0]}function d(n,t){return{type:n.type===1?2:n.type,lower:br(n.lower,n.lowerOpen?e.MAX_KEY:e.MIN_KEY,t),lowerOpen:true,upper:br(n.upper,n.upperOpen?e.MIN_KEY:e.MAX_KEY,t),upperOpen:true}}function v(e){var t=e.query.index;return t.isVirtual?n(n({},e),{query:{index:t,range:d(e.query.range,t.keyTail)}}):e}var p=n(n({},t),{schema:n(n({},i),{primaryKey:s,indexes:o,getIndexByKeyPath:h}),count:function e(n){return t.count(v(n))},query:function e(n){return t.query(v(n))},openCursor:function n(r){var i=r.query.index,a=i.keyTail,o=i.isVirtual,u=i.keyLength;if(!o)return t.openCursor(r);function s(n){function t(t){t!=null?n["continue"](br(t,r.reverse?e.MAX_KEY:e.MIN_KEY,a)):r.unique?n["continue"](n.key.slice(0,u).concat(r.reverse?e.MIN_KEY:e.MAX_KEY,a)):n["continue"]()}var i=Object.create(n,{continue:{value:t},continuePrimaryKey:{value:function t(r,i){n.continuePrimaryKey(br(r,e.MAX_KEY,a),i)}},primaryKey:{get:function e(){return n.primaryKey}},key:{get:function e(){var t=n.key;return u===1?t[0]:t.slice(0,u)}},value:{get:function e(){return n.value}}});return i}return t.openCursor(v(r)).then((function(e){return e&&s(e)}))}});return p}})}var wr={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:gr};function _r(e,n,t,r){t=t||{};r=r||"";i(e).forEach((function(i){if(!c(n,i)){t[r+i]=undefined}else{var a=e[i],o=n[i];if(babelHelpers["typeof"](a)==="object"&&babelHelpers["typeof"](o)==="object"&&a&&o){var u=T(a);var s=T(o);if(u!==s){t[r+i]=n[i]}else if(u==="Object"){_r(a,o,t,r+i+".")}else if(a!==o){t[r+i]=n[i]}}else if(a!==o)t[r+i]=n[i]}}));i(n).forEach((function(i){if(!c(e,i)){t[r+i]=n[i]}}));return t}function xr(e,n){if(n.type==="delete")return n.keys;return n.keys||n.values.map(e.extractKey)}var kr={stack:"dbcore",name:"HooksMiddleware",level:2,create:function e(r){return n(n({},r),{table:function e(i){var a=r.table(i);var o=a.schema.primaryKey;var u=n(n({},a),{mutate:function e(r){var u=Fe.trans;var s=u.table(i).hook,f=s.deleting,l=s.creating,h=s.updating;switch(r.type){case"add":if(l.fire===ue)break;return u._promise("readwrite",(function(){return d(r)}),true);case"put":if(l.fire===ue&&h.fire===ue)break;return u._promise("readwrite",(function(){return d(r)}),true);case"delete":if(f.fire===ue)break;return u._promise("readwrite",(function(){return d(r)}),true);case"deleteRange":if(f.fire===ue)break;return u._promise("readwrite",(function(){return v(r)}),true)}return a.mutate(r);function d(e){var r=Fe.trans;var i=e.keys||xr(o,e);if(!i)throw new Error("Keys missing");e=e.type==="add"||e.type==="put"?n(n({},e),{keys:i}):n({},e);if(e.type!=="delete")e.values=t([],e.values,true);if(e.keys)e.keys=t([],e.keys,true);return Er(a,e,i).then((function(n){var t=i.map((function(t,i){var a=n[i];var u={onerror:null,onsuccess:null};if(e.type==="delete"){f.fire.call(u,t,a,r)}else if(e.type==="add"||a===undefined){var s=l.fire.call(u,t,e.values[i],r);if(t==null&&s!=null){t=s;e.keys[i]=t;if(!o.outbound){E(e.values[i],o.keyPath,t)}}}else{var d=_r(a,e.values[i]);var v=h.fire.call(u,d,t,a,r);if(v){var p=e.values[i];Object.keys(v).forEach((function(e){if(c(p,e)){p[e]=v[e]}else{E(p,e,v[e])}}))}}return u}));return a.mutate(e).then((function(r){var a=r.failures,o=r.results,u=r.numFailures,s=r.lastResult;for(var c=0;c<i.length;++c){var f=o?o[c]:i[c];var l=t[c];if(f==null){l.onerror&&l.onerror(a[c])}else{l.onsuccess&&l.onsuccess(e.type==="put"&&n[c]?e.values[c]:f)}}return{failures:a,results:o,numFailures:u,lastResult:s}}))["catch"]((function(e){t.forEach((function(n){return n.onerror&&n.onerror(e)}));return Promise.reject(e)}))}))}function v(e){return p(e.trans,e.range,1e4)}function p(e,t,r){return a.query({trans:e,values:false,query:{index:o,range:t},limit:r}).then((function(i){var a=i.result;return d({type:"delete",keys:a,trans:e}).then((function(i){if(i.numFailures>0)return Promise.reject(i.failures[0]);if(a.length<r){return{failures:[],numFailures:0,lastResult:undefined}}else{return p(e,n(n({},t),{lower:a[a.length-1],lowerOpen:true}),r)}}))}))}}});return u}})}};function Er(e,n,t){return n.type==="add"?Promise.resolve([]):e.getMany({trans:n.trans,keys:t,cache:"immutable"})}function Pr(e,n,t){try{if(!n)return null;if(n.keys.length<e.length)return null;var r=[];for(var i=0,a=0;i<n.keys.length&&a<e.length;++i){if(rt(n.keys[i],e[a])!==0)continue;r.push(t?I(n.values[i]):n.values[i]);++a}return r.length===e.length?r:null}catch(e){return null}}var Kr={stack:"dbcore",level:-1,create:function e(t){return{table:function e(r){var e=t.table(r);return n(n({},e),{getMany:function n(t){if(!t.cache){return e.getMany(t)}var r=Pr(t.keys,t.trans["_cache"],t.cache==="clone");if(r){return Ue.resolve(r)}return e.getMany(t).then((function(e){t.trans["_cache"]={keys:t.keys,values:t.cache==="clone"?I(e):e};return e}))},mutate:function n(t){if(t.type!=="add")t.trans["_cache"]=null;return e.mutate(t)}})}}}};var Or;function Sr(e){return!("from"in e)}var Ar=function e(n,t){if(this){o(this,arguments.length?{d:1,from:n,to:arguments.length>1?t:n}:{d:0})}else{var r=new e;if(n&&"d"in n){o(r,n)}return r}};f(Ar.prototype,(Or={add:function e(n){jr(this,n);return this},addKey:function e(n){Cr(this,n,n);return this},addKeys:function e(n){var t=this;n.forEach((function(e){return Cr(t,e,e)}));return this}},Or[R]=function(){return Dr(this)},Or));function Cr(e,n,t){var r=rt(n,t);if(isNaN(r))return;if(r>0)throw RangeError();if(Sr(e))return o(e,{from:n,to:t,d:1});var i=e.l;var a=e.r;if(rt(t,e.from)<0){i?Cr(i,n,t):e.l={from:n,to:t,d:1,l:null,r:null};return Br(e)}if(rt(n,e.to)>0){a?Cr(a,n,t):e.r={from:n,to:t,d:1,l:null,r:null};return Br(e)}if(rt(n,e.from)<0){e.from=n;e.l=null;e.d=a?a.d+1:1}if(rt(t,e.to)>0){e.to=t;e.r=null;e.d=e.l?e.l.d+1:1}var u=!e.r;if(i&&!e.l){jr(e,i)}if(a&&u){jr(e,a)}}function jr(e,n){function t(e,n){var r=n.from,i=n.to,a=n.l,o=n.r;Cr(e,r,i);if(a)t(e,a);if(o)t(e,o)}if(!Sr(n))t(e,n)}function Ir(e,n){var t=Dr(n);var r=t.next();if(r.done)return false;var i=r.value;var a=Dr(e);var o=a.next(i.from);var u=o.value;while(!r.done&&!o.done){if(rt(u.from,i.to)<=0&&rt(u.to,i.from)>=0)return true;rt(i.from,u.from)<0?i=(r=t.next(u.from)).value:u=(o=a.next(i.from)).value}return false}function Dr(e){var n=Sr(e)?null:{s:0,n:e};return{next:function e(t){var r=arguments.length>0;while(n){switch(n.s){case 0:n.s=1;if(r){while(n.n.l&&rt(t,n.n.from)<0){n={up:n,n:n.n.l,s:1}}}else{while(n.n.l){n={up:n,n:n.n.l,s:1}}}case 1:n.s=2;if(!r||rt(t,n.n.to)<=0)return{value:n.n,done:false};case 2:if(n.n.r){n.s=3;n={up:n,n:n.n.r,s:0};continue}case 3:n=n.up}}return{done:true}}}}function Br(e){var t,r;var i=(((t=e.r)===null||t===void 0?void 0:t.d)||0)-(((r=e.l)===null||r===void 0?void 0:r.d)||0);var a=i>1?"r":i<-1?"l":"";if(a){var o=a==="r"?"l":"r";var u=n({},e);var s=e[a];e.from=s.from;e.to=s.to;e[a]=s[a];u[a]=s[o];e[o]=u;u.d=Tr(u)}e.d=Tr(e)}function Tr(e){var n=e.r,t=e.l;return(n?t?Math.max(n.d,t.d):n.d:t?t.d:0)+1}var Rr={stack:"dbcore",level:0,create:function e(t){var r=t.schema.name;var o=new Ar(t.MIN_KEY,t.MAX_KEY);return n(n({},t),{table:function e(u){var e=t.table(u);var s=e.schema;var c=s.primaryKey;var f=c.extractKey,l=c.outbound;var h=n(n({},e),{mutate:function n(t){var i=t.trans;var c=i.mutatedParts||(i.mutatedParts={});var f=function e(n){var t="idb://"+r+"/"+u+"/"+n;return c[t]||(c[t]=new Ar)};var l=f("");var h=f(":dels");var d=t.type;var v=t.type==="deleteRange"?[t.range]:t.type==="delete"?[t.keys]:t.values.length<50?[[],t.values]:[],p=v[0],y=v[1];var m=t.trans["_cache"];return e.mutate(t).then((function(e){if(a(p)){if(d!=="delete")p=e.results;l.addKeys(p);var n=Pr(p,m);if(!n&&d!=="add"){h.addKeys(p)}if(n||y){Fr(f,s,n,y)}}else if(p){var t={from:p.lower,to:p.upper};h.add(t);l.add(t)}else{l.add(o);h.add(o);s.indexes.forEach((function(e){return f(e.name).add(o)}))}return e}))}});var d=function e(n){var r,i;var a=n.query,o=a.index,u=a.range;return[o,new Ar((r=u.lower)!==null&&r!==void 0?r:t.MIN_KEY,(i=u.upper)!==null&&i!==void 0?i:t.MAX_KEY)]};var v={get:function e(n){return[c,new Ar(n.key)]},getMany:function e(n){return[c,(new Ar).addKeys(n.keys)]},count:d,query:d,openCursor:d};i(v).forEach((function(t){h[t]=function(i){var a=Fe.subscr;if(a){var s=function e(n){var t="idb://"+r+"/"+u+"/"+n;return a[t]||(a[t]=new Ar)};var c=s("");var h=s(":dels");var d=v[t](i),p=d[0],y=d[1];s(p.name||"").add(y);if(!p.isPrimaryKey){if(t==="count"){h.add(o)}else{var m=t==="query"&&l&&i.values&&e.query(n(n({},i),{values:false}));return e[t].apply(this,arguments).then((function(e){if(t==="query"){if(l&&i.values){return m.then((function(n){var t=n.result;c.addKeys(t);return e}))}var n=i.values?e.result.map(f):e.result;if(i.values){c.addKeys(n)}else{h.addKeys(n)}}else if(t==="openCursor"){var r=e;var a=i.values;return r&&Object.create(r,{key:{get:function e(){h.addKey(r.primaryKey);return r.key}},primaryKey:{get:function e(){var n=r.primaryKey;h.addKey(n);return n}},value:{get:function e(){a&&c.addKey(r.primaryKey);return r.value}}})}return e}))}}}return e[t].apply(this,arguments)}}));return h}})}};function Fr(e,n,t,r){function i(n){var i=e(n.name||"");function o(e){return e!=null?n.extractKey(e):null}var u=function e(t){return n.multiEntry&&a(t)?t.forEach((function(e){return i.addKey(e)})):i.addKey(t)};(t||r).forEach((function(e,n){var i=t&&o(t[n]);var a=r&&o(r[n]);if(rt(i,a)!==0){if(i!=null)u(i);if(a!=null)u(a)}}))}n.indexes.forEach(i)}var Mr=function(){function e(t,r){var i=this;this._middlewares={};this.verno=0;var a=e.dependencies;this._options=r=n({addons:e.addons,autoOpen:true,indexedDB:a.indexedDB,IDBKeyRange:a.IDBKeyRange},r);this._deps={indexedDB:r.indexedDB,IDBKeyRange:r.IDBKeyRange};var o=r.addons;this._dbSchema={};this._versions=[];this._storeNames=[];this._allTables={};this.idbdb=null;this._novip=this;var u={dbOpenError:null,isBeingOpened:false,onReadyBeingFired:null,openComplete:false,dbReadyResolve:ue,dbReadyPromise:null,cancelOpen:ue,openCanceller:null,autoSchema:true,PR1398_maxLoop:3};u.dbReadyPromise=new Ue((function(e){u.dbReadyResolve=e}));u.openCanceller=new Ue((function(e,n){u.cancelOpen=n}));this._state=u;this.name=t;this.on=Yn(this,"populate","blocked","versionchange","close",{ready:[pe,ue]});this.on.ready.subscribe=b(this.on.ready.subscribe,(function(n){return function(t,r){e.vip((function(){var e=i._state;if(e.openComplete){if(!e.dbOpenError)Ue.resolve().then(t);if(r)n(t)}else if(e.onReadyBeingFired){e.onReadyBeingFired.push(t);if(r)n(t)}else{n(t);var a=i;if(!r)n((function e(){a.on.ready.unsubscribe(t);a.on.ready.unsubscribe(e)}))}}))}}));this.Collection=ft(this);this.Table=Xn(this);this.Transaction=At(this);this.Version=or(this);this.WhereClause=xt(this);this.on("versionchange",(function(e){if(e.newVersion>0)console.warn("Another connection wants to upgrade database '"+i.name+"'. Closing db now to resume the upgrade.");else console.warn("Another connection wants to delete database '"+i.name+"'. Closing db now to resume the delete request.");i.close()}));this.on("blocked",(function(e){if(!e.newVersion||e.newVersion<e.oldVersion)console.warn("Dexie.delete('"+i.name+"') was blocked");else console.warn("Upgrade '"+i.name+"' blocked by other connection holding version "+e.oldVersion/10)}));this._maxKey=Bt(r.IDBKeyRange);this._createTransaction=function(e,n,t,r){return new i.Transaction(e,n,t,i._options.chromeTransactionDurability,r)};this._fireOnBlocked=function(e){i.on("blocked").fire(e);Bn.filter((function(e){return e.name===i.name&&e!==i&&!e._state.vcFired})).map((function(n){return n.on("versionchange").fire(e)}))};this.use(wr);this.use(kr);this.use(Rr);this.use(Kr);this.vip=Object.create(this,{_vip:{value:true}});o.forEach((function(e){return e(i)}))}e.prototype.version=function(e){if(isNaN(e)||e<.1)throw new re.Type("Given version is not a positive number");e=Math.round(e*10)/10;if(this.idbdb||this._state.isBeingOpened)throw new re.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,e);var n=this._versions;var t=n.filter((function(n){return n._cfg.version===e}))[0];if(t)return t;t=new this.Version(e);n.push(t);n.sort(Yt);t.stores({});this._state.autoSchema=false;return t};e.prototype._whenReady=function(e){var n=this;return this.idbdb&&(this._state.openComplete||Fe.letThrough||this._vip)?e():new Ue((function(e,t){if(n._state.openComplete){return t(new re.DatabaseClosed(n._state.dbOpenError))}if(!n._state.isBeingOpened){if(!n._options.autoOpen){t(new re.DatabaseClosed);return}n.open()["catch"](ue)}n._state.dbReadyPromise.then(e,t)})).then(e)};e.prototype.use=function(e){var n=e.stack,t=e.create,r=e.level,i=e.name;if(i)this.unuse({stack:n,name:i});var a=this._middlewares[n]||(this._middlewares[n]=[]);a.push({stack:n,create:t,level:r==null?10:r,name:i});a.sort((function(e,n){return e.level-n.level}));return this};e.prototype.unuse=function(e){var n=e.stack,t=e.name,r=e.create;if(n&&this._middlewares[n]){this._middlewares[n]=this._middlewares[n].filter((function(e){return r?e.create!==r:t?e.name!==t:false}))}return this};e.prototype.open=function(){return vr(this)};e.prototype._close=function(){var e=this._state;var n=Bn.indexOf(this);if(n>=0)Bn.splice(n,1);if(this.idbdb){try{this.idbdb.close()}catch(e){}this._novip.idbdb=null}e.dbReadyPromise=new Ue((function(n){e.dbReadyResolve=n}));e.openCanceller=new Ue((function(n,t){e.cancelOpen=t}))};e.prototype.close=function(){this._close();var e=this._state;this._options.autoOpen=false;e.dbOpenError=new re.DatabaseClosed;if(e.isBeingOpened)e.cancelOpen(e.dbOpenError)};e.prototype["delete"]=function(){var e=this;var n=arguments.length>0;var t=this._state;return new Ue((function(r,i){var a=function n(){e.close();var t=e._deps.indexedDB.deleteDatabase(e.name);t.onsuccess=on((function(){lr(e._deps,e.name);r()}));t.onerror=kt(i);t.onblocked=e._fireOnBlocked};if(n)throw new re.InvalidArgument("Arguments not allowed in db.delete()");if(t.isBeingOpened){t.dbReadyPromise.then(a)}else{a()}}))};e.prototype.backendDB=function(){return this.idbdb};e.prototype.isOpen=function(){return this.idbdb!==null};e.prototype.hasBeenClosed=function(){var e=this._state.dbOpenError;return e&&e.name==="DatabaseClosed"};e.prototype.hasFailed=function(){return this._state.dbOpenError!==null};e.prototype.dynamicallyOpened=function(){return this._state.autoSchema};Object.defineProperty(e.prototype,"tables",{get:function e(){var n=this;return i(this._allTables).map((function(e){return n._allTables[e]}))},enumerable:false,configurable:true});e.prototype.transaction=function(){var e=yr.apply(this,arguments);return this._transaction.apply(this,e)};e.prototype._transaction=function(e,n,t){var r=this;var i=Fe.trans;if(!i||i.db!==this||e.indexOf("!")!==-1)i=null;var a=e.indexOf("?")!==-1;e=e.replace("!","").replace("?","");var o,u;try{u=n.map((function(e){var n=e instanceof r.Table?e.name:e;if(typeof n!=="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return n}));if(e=="r"||e===qn)o=qn;else if(e=="rw"||e==Un)o=Un;else throw new re.InvalidArgument("Invalid transaction mode: "+e);if(i){if(i.mode===qn&&o===Un){if(a){i=null}else throw new re.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY")}if(i){u.forEach((function(e){if(i&&i.storeNames.indexOf(e)===-1){if(a){i=null}else throw new re.SubTransaction("Table "+e+" not included in parent transaction.")}}))}if(a&&i&&!i.active){i=null}}}catch(e){return i?i._promise(null,(function(n,t){t(e)})):On(e)}var s=mr.bind(null,this,o,u,i,t);return i?i._promise(o,s,"lock"):Fe.trans?_n(Fe.transless,(function(){return r._whenReady(s)})):this._whenReady(s)};e.prototype.table=function(e){if(!c(this._allTables,e)){throw new re.InvalidTable("Table "+e+" does not exist")}return this._allTables[e]};return e}();var Nr=typeof Symbol!=="undefined"&&"observable"in Symbol?Symbol.observable:"@@observable";var qr=function(){function e(e){this._subscribe=e}e.prototype.subscribe=function(e,n,t){return this._subscribe(!e||typeof e==="function"?{next:e,error:n,complete:t}:e)};e.prototype[Nr]=function(){return this};return e}();function Ur(e,n){i(n).forEach((function(t){var r=e[t]||(e[t]=new Ar);jr(r,n[t])}));return e}function Hr(e){return new qr((function(n){var t=q(e);function r(n){if(t){vn()}var r=function t(){return dn(e,{subscr:n,trans:null})};var i=Fe.trans?_n(Fe.transless,r):r();if(t){i.then(pn,pn)}return i}var a=false;var o={};var u={};var s={get closed(){return a},unsubscribe:function e(){a=true;Ot.storagemutated.unsubscribe(h)}};n.start&&n.start(s);var c=false,f=false;function l(){return i(u).some((function(e){return o[e]&&Ir(o[e],u[e])}))}var h=function e(n){Ur(o,n);if(l()){d()}};var d=function e(){if(c||a)return;o={};var t={};var i=r(t);if(!f){Ot(Pt,h);f=true}c=true;Promise.resolve(i).then((function(r){c=false;if(a)return;if(l()){e()}else{o={};u=t;n.next&&n.next(r)}}),(function(e){c=false;n.error&&n.error(e);s.unsubscribe()}))};d();return s}))}var Lr;try{Lr={indexedDB:r.indexedDB||r.mozIndexedDB||r.webkitIndexedDB||r.msIndexedDB,IDBKeyRange:r.IDBKeyRange||r.webkitIDBKeyRange}}catch(e){Lr={indexedDB:null,IDBKeyRange:null}}var Vr=Mr;f(Vr,n(n({},oe),{delete:function e(n){var t=new Vr(n,{addons:[]});return t["delete"]()},exists:function e(n){return new Vr(n,{addons:[]}).open().then((function(e){e.close();return true}))["catch"]("NoSuchDatabaseError",(function(){return false}))},getDatabaseNames:function e(n){try{return cr(Vr.dependencies).then(n)}catch(e){return On(new re.MissingAPI)}},defineClass:function e(){function n(e){o(this,e)}return n},ignoreTransaction:function e(n){return Fe.trans?_n(Fe.transless,n):n()},vip:hr,async:function e(n){return function(){try{var e=pr(n.apply(this,arguments));if(!e||typeof e.then!=="function")return Ue.resolve(e);return e}catch(e){return On(e)}}},spawn:function e(n,t,r){try{var i=pr(n.apply(r,t||[]));if(!i||typeof i.then!=="function")return Ue.resolve(i);return i}catch(e){return On(e)}},currentTransaction:{get:function e(){return Fe.trans||null}},waitFor:function e(n,t){var r=Ue.resolve(typeof n==="function"?Vr.ignoreTransaction(n):n).timeout(t||6e4);return Fe.trans?Fe.trans.waitFor(r):r},Promise:Ue,debug:{get:function e(){return U},set:function e(n){H(n,n==="dexie"?function(){return true}:Mn)}},derive:d,extend:o,props:f,override:b,Events:Yn,on:Ot,liveQuery:Hr,extendObservabilitySet:Ur,getByKeyPath:k,setByKeyPath:E,delByKeyPath:P,shallowClone:K,deepClone:I,getObjectDiff:_r,cmp:rt,asap:w,minKey:jn,addons:[],connections:Bn,errnames:ne,dependencies:Lr,semVer:An,version:An.split(".").map((function(e){return parseInt(e)})).reduce((function(e,n,t){return e+n/Math.pow(10,t*2)}))}));Vr.maxKey=Bt(Vr.dependencies.IDBKeyRange);if(typeof dispatchEvent!=="undefined"&&typeof addEventListener!=="undefined"){Ot(Pt,(function(e){if(!Yr){var n;if(Tn){n=document.createEvent("CustomEvent");n.initCustomEvent(Kt,true,true,e)}else{n=new CustomEvent(Kt,{detail:e})}Yr=true;dispatchEvent(n);Yr=false}}));addEventListener(Kt,(function(e){var n=e.detail;if(!Yr){Wr(n)}}))}function Wr(e){var n=Yr;try{Yr=true;Ot.storagemutated.fire(e)}finally{Yr=n}}var Yr=false;if(typeof BroadcastChannel!=="undefined"){var zr=new BroadcastChannel(Kt);Ot(Pt,(function(e){if(!Yr){zr.postMessage(e)}}));zr.onmessage=function(e){if(e.data)Wr(e.data)}}else if(typeof self!=="undefined"&&typeof navigator!=="undefined"){Ot(Pt,(function(e){try{if(!Yr){if(typeof localStorage!=="undefined"){localStorage.setItem(Kt,JSON.stringify({trig:Math.random(),changedParts:e}))}if(babelHelpers["typeof"](self["clients"])==="object"){t([],self["clients"].matchAll({includeUncontrolled:true}),true).forEach((function(n){return n.postMessage({type:Kt,changedParts:e})}))}}}catch(e){}}));if(typeof addEventListener!=="undefined"){addEventListener("storage",(function(e){if(e.key===Kt){var n=JSON.parse(e.newValue);if(n)Wr(n.changedParts)}}))}var Xr=self.document&&navigator.serviceWorker;if(Xr){Xr.addEventListener("message",Gr)}}function Gr(e){var n=e.data;if(n&&n.type===Kt){Wr(n.changedParts)}}Ue.rejectionMapper=ae;H(U,Mn);window.BX.Dexie=Mr;e.Dexie=Mr;e.liveQuery=Hr;e.RangeSet=Ar;e.mergeRanges=jr;e.rangesOverlap=Ir})(this.BX.Dexie3=this.BX.Dexie3||{});
//# sourceMappingURL=dexie3.bundle.map.js